Skip to content

Instantly share code, notes, and snippets.

View kayahanbaskeser's full-sized avatar
:octocat:

Kayahan Baskeser kayahanbaskeser

:octocat:
  • Teknasyon
  • Istanbul, Turkey
View GitHub Profile
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Obtain the HiAnalyticsInstance instance.
HiAnalyticsInstance instance = HiAnalytics.getInstance(this);
HiAnalyticsTools.enableLog();
// Insert tracing points to report custom events.
package com.kb.healthKit;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.huawei.hmf.tasks.OnFailureListener;
package com.huawei.demo.hihealth;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
import android.util.Log;
import android.view.View;
import android.widget.TextView;
public class SensorsController extends AppCompatActivity {
private static final String TAG = "SensorsControllerTest";
private Context context;
private SensorsController sensorsController;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_hihealth_sensor);
HiHealthOptions options = HiHealthOptions.builder().build();
HiHealthOptions options = HiHealthOptions.builder().build();
AuthHuaweiId signInHuaweiId = HuaweiIdAuthManager.getExtendedAuthResult(options);
AutoRecorderController controller = HuaweiHiHealth.getAutoRecorderController(context, signInHuaweiId);
DataType dataType = DataType.DT_CONTINUOUS_STEPS_TOTAL;
controller.startRecord(dataType).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(Task<Void> taskResult) {
if (taskResult.isSuccessful()) {
Log.i("AutoRecorderTest","onComplete startRecordByType Successful");
HiHealthOptions options = HiHealthOptions.builder().build();
AuthHuaweiId signInHuaweiId = HuaweiIdAuthManager.getExtendedAuthResult(options);
AutoRecorderController controller = HuaweiHiHealth.getAutoRecorderController(context, signInHuaweiId);
controller.stopRecord(DataType.DT_CONTINUOUS_STEPS_TOTAL)
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(Task<Void> taskResult) {
if (taskResult.isSuccessful()) {
Log.i("AutoRecorderTest","onComplete stopRecordByType Successful");
HiHealthOptions options = HiHealthOptions.builder().build();
AuthHuaweiId signInHuaweiId = HuaweiIdAuthManager.getExtendedAuthResult(options);
AutoRecorderController controller = HuaweiHiHealth.getAutoRecorderController(context, signInHuaweiId);
controller.getRecords().addOnCompleteListener(new OnCompleteListener<List<Record>>() {
@Override
public void onComplete(Task<List<Record>> task) {
Log.i("AutoRecorderTest","getAllRecords:onComplete");
if (task.isSuccessful()) {
Log.i("AutoRecorderTest","getAllRecords Successfully");
@kayahanbaskeser
kayahanbaskeser / LuaLoader.java
Last active September 15, 2020 22:05
define these variables in LuaLoader.class
public AdParam adParam;
private BannerView bannerView;
private FrameLayout layout;
public String bannarAdId = "testw6vs28auh3";
@kayahanbaskeser
kayahanbaskeser / PushKitManager.cs
Last active March 4, 2021 05:52
PushKitManager.cs | Key-Value Pairs of Notification Message
// To get key-value pairs of notification message, call this method on awake or start methods.
// https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/android-client-dev-0000001050042041#EN-US_TOPIC_0000001078601368__section934442861712
// https://github.com/EvilMindDevs/hms-unity-plugin
public void getIntentData()
{
AndroidJavaClass UnityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject currentActivity = UnityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
AndroidJavaObject intent = currentActivity.Call<AndroidJavaObject>("getIntent");
if (intent == null) return;
@kayahanbaskeser
kayahanbaskeser / IapManager.cs
Created March 18, 2021 14:49
CheckIapAvailability update
public void CheckIapAvailability()
{
iapClient = Iap.GetIapClient();
ITask<EnvReadyResult> task = iapClient.EnvReady;
task.AddOnSuccessListener((result) =>
{
Debug.Log($"{TAG}: checkIapAvailabity SUCCESS");
iapAvailable = true;
OnCheckIapAvailabilitySuccess?.Invoke();
}).AddOnFailureListener(exception =>