[HMS Core] Which device of the user does the Health Kit want to check the data from? How to check it?

 【Problem description 1】

How to check which device the user's fitness data comes from?

【solution】

You can query the device information that provides the data through the dataCollectorId carried in the returned data:

Example request (take querying sleep record details as an example):

1. Query sleep records and associate sleep state sampling data:

cke_6583.png

2. According to the dataCollectorId returned by the associated sampling data, call and query the specified data collector interface to query the device information generated by the record:

cke_7828.png

Query the guide for specifying data collectors: https://developer.huawei.com/consumer/cn/doc/development/HMSCore-References/datacollectors_get-0000001050116807

Response parameters:

cke_8846.png

 

 

【Problem description 2】

1. After the user authorizes the corresponding health data permissions (such as height, heart rate, blood pressure), if the user wants to change the authorization item and only authorize us to query the heart rate, then is there any way to cancel the previous authorization?

2. The user is authorized by logging in. If the user session has not expired, even if we return the authorization page to the user again, the page will directly skip the login, and the user cannot be authorized again. How to solve it?

【solution】

1. The REST API provides an interface for deauthorization. You may call the deauthorization interface for users to cancel authorized permissions.

2. Currently, the deauthorization interface provided by the REST API will cancel all the authorizations of the application to the HUAWEI account, and does not currently support the deauthorization of a single permission.

3. If you need to deauthorize a separate permission, you can guide the user to select the application you want to deauthorize in "Huawei Sports Health App > My > Privacy Management > Data Sharing and Authorization > Account Authorization Application" and proceed Manually deauthorize.

Cancellation Authorization Guide: https://developer.huawei.com/consumer/cn/doc/development/HMSCore-Guides/canceling-authorization-0000001209549384

Description of the cancel authorization interface: https://developer.huawei.com/consumer/cn/doc/development/HMSCore-References/cancel-scpoes-0000001059462192

cke_10188.png

 

 For more comprehensive technical articles, please visit https://developer.huawei.com/consumer/cn/forum/?ha_source=zzh

{{o.name}}
{{m.name}}

Guess you like

Origin my.oschina.net/u/4478396/blog/8725102