This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public AdParam adParam; | |
private BannerView bannerView; | |
private FrameLayout layout; | |
public String bannarAdId = "testw6vs28auh3"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 => |