private void InitAutoRecorderController() { HiHealthOptions hiHealthOptions = HiHealthOptions.HiHealthOptionsBulider().Build(); AuthHuaweiId signInHuaweiId = HuaweiIdAuthManager.GetExtendedAuthResult(hiHealthOptions); MyAutoRecorderController = HuaweiHiHealth.GetAutoRecorderController(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); }
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--; } }