コード例 #1
0
        //check whether the Huawei Health app authorise access to HealthKit.
        //After calling this function, if you do not authorise, we will pop the windows to Health app authorization windows.
        public async void CheckAuthorization()
        {
            // check whether the Huawei Health app authorise access to HealthKit.
            // if you do not authorise, we will pop the windows to Health app authorization windows.
            var CheckTask = MySettingController.CheckHealthAppAuthorizationAsync();

            try
            {
                await CheckTask;

                if (CheckTask.IsCompleted)
                {
                    if (CheckTask.Exception == null)
                    {
                        Logger("checkHealthAppAuthorisation is completed ");
                    }
                    else
                    {
                        PrintFailureMessage(CheckTask.Exception, "checkHealthAppAuthorization");
                    }
                }
            }
            catch (System.Exception ex)
            {
                PrintFailureMessage(ex, "checkHealthAppAuthorization");
            }
        }