private void InitAutoRecorderController() { HiHealthOptions hiHealthOptions = HiHealthOptions.HiHealthOptionsBulider().Build(); AuthHuaweiId signInHuaweiId = HuaweiIdAuthManager.GetExtendedAuthResult(hiHealthOptions); MyAutoRecorderController = HuaweiHiHealth.GetAutoRecorderController(this, signInHuaweiId); }
private void InitSettingController() { // create HiHealth Options, donnot add any datatype here. HiHealthOptions hiHealthOptions = HiHealthOptions.HiHealthOptionsBulider().Build(); // get AuthHuaweiId by HiHealth Options. AuthHuaweiId signInHuaweiId = HuaweiIdAuthManager.GetExtendedAuthResult(hiHealthOptions); MySettingController = HuaweiHiHealth.GetSettingController(this, signInHuaweiId); }
// Check the connectivity private void CheckConnect() { if (MyActivityRecordsController == null) { HiHealthOptions hiHealthOptions = HiHealthOptions.HiHealthOptionsBulider().Build(); AuthHuaweiId signInHuaweiId = HuaweiIdAuthManager.GetExtendedAuthResult(hiHealthOptions); MyActivityRecordsController = HuaweiHiHealth.GetActivityRecordsController(this, signInHuaweiId); } }
//Initiate BleController private void InitBLEController() { if (MyBleController == null) { HiHealthOptions hiHealthOptions = HiHealthOptions.HiHealthOptionsBulider().Build(); AuthHuaweiId signInHuaweiId = HuaweiIdAuthManager.GetExtendedAuthResult(hiHealthOptions); MyBleController = HuaweiHiHealth.GetBleController(this, signInHuaweiId); } }
protected override void OnActivityResult(int requestCode, Android.App.Result resultCode, Intent data) { base.OnActivityResult(requestCode, resultCode, data); HiHealthOptions hiHealthOptions = HiHealthOptions.HiHealthOptionsBulider().Build(); AuthHuaweiId signInHuaweiId = HuaweiIdAuthManager.GetExtendedAuthResult(hiHealthOptions); MyAutoRecorderController = HuaweiHiHealth.GetAutoRecorderController(this, signInHuaweiId); }
private void InitService() { Log.Info(TAG, "HiHealthKitClient connect to service"); // Initialize SettingController HiHealthOptions fitnessOptions = HiHealthOptions.HiHealthOptionsBulider().Build(); AuthHuaweiId signInHuaweiId = HuaweiIdAuthManager.GetExtendedAuthResult(fitnessOptions); MySettingController = HuaweiHiHealth.GetSettingController(this, signInHuaweiId); }
private void InitDataController() { // Obtain and set the read & write permissions for DtContinuousStepsDelta and DtInstantaneousHeight. // Use the obtained permissions to obtain the data controller object. HiHealthOptions hiHealthOptions = HiHealthOptions.HiHealthOptionsBulider() .AddDataType(DataType.DtContinuousStepsDelta, HiHealthOptions.AccessRead) .AddDataType(DataType.DtContinuousStepsDelta, HiHealthOptions.AccessWrite) .AddDataType(DataType.DtInstantaneousHeight, HiHealthOptions.AccessRead) .AddDataType(DataType.DtInstantaneousHeight, HiHealthOptions.AccessWrite) .Build(); AuthHuaweiId signInHuaweiId = HuaweiIdAuthManager.GetExtendedAuthResult(hiHealthOptions); MyDataController = HuaweiHiHealth.GetDataController(this, signInHuaweiId); }
public async void StopRecordByType() { Logger("StopRecordByType"); if (MyAutoRecorderController == null) { HiHealthOptions hiHealthOptions = HiHealthOptions.HiHealthOptionsBulider().Build(); AuthHuaweiId signInHuaweiId = HuaweiIdAuthManager.GetExtendedAuthResult(hiHealthOptions); MyAutoRecorderController = HuaweiHiHealth.GetAutoRecorderController(this, signInHuaweiId); } Task StopTask = MyAutoRecorderController.StopRecordAsync(Huawei.Hms.Hihealth.Data.DataType.DtContinuousStepsTotal, new MySamplePointListener()); try { await StopTask; if (StopTask.IsCompleted) { if (StopTask.Exception == null) { Logger("StopRecordByType Successful"); Logger(Split); } else { Logger("StopRecordByType Failed: " + StopTask.Exception); Logger(Split); } } } catch (System.Exception ex) { Logger("StopRecordByType Failed: " + ex.Message); Logger(Split); } if (Count > 0) { StopService(intent); this.UnregisterReceiver(Receiver); Count--; } }
private void Init() { HiHealthOptions hiHealthOptions = HiHealthOptions.HiHealthOptionsBulider().Build(); AuthHuaweiId signInHuaweiId = HuaweiIdAuthManager.GetExtendedAuthResult(hiHealthOptions); MyActivityRecordsController = HuaweiHiHealth.GetActivityRecordsController(this, signInHuaweiId); MyDataController = HuaweiHiHealth.GetDataController(this, signInHuaweiId); LogInfoView = (TextView)FindViewById(Resource.Id.activity_records_controller_log_info); LogInfoView.MovementMethod = ScrollingMovementMethod.Instance; BeginActivity = (Button)FindViewById(Resource.Id.records_controller_begin_activity); EndActivity = (Button)FindViewById(Resource.Id.records_controller_end_activity); AddActivity = (Button)FindViewById(Resource.Id.records_controller_add_activity); GetActivity = (Button)FindViewById(Resource.Id.records_controller_get_activity); DeleteActivity = (Button)FindViewById(Resource.Id.records_controller_delete_activity); BeginActivity.Click += delegate { BeginActivityRecord(); }; EndActivity.Click += delegate { EndActivityRecord(); }; AddActivity.Click += delegate { AddActivityRecord(); }; GetActivity.Click += delegate { GetActivityRecord(); }; DeleteActivity.Click += delegate { DeleteActivityRecord(); }; }