Intelligent Assistant
Chat with our virtual assistant to get answers promptly.
We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.
To improve privacy security, your app should allow users to cancel authorization after Obtaining User Authorization.
The key steps for developing the function of canceling authorization from your app are as follows:
// Log tag
private static final String TAG = "HealthKitConsents";
public void cancelAuthorization(View view) {
// 1. Obtain a ConsentsController object.
// Note that this refers to an Activity object.
ConsentsController mConsentsController = HuaweiHiHealth.getConsentsController(this);
// 2. Specify whether to delete user data. true if so; false otherwise.
boolean clearUserData = true;
// 3. Cancel all authorization granted to the app and delete user data.
Task<Void> task = mConsentsController.cancelAuthorization(clearUserData);
task.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Log.i(TAG, "cancelAuthorization success");
if(clearUserData){
Log.i(TAG, "clearUserData success");
}
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(Exception e) {
Log.e(TAG, "cancelAuthorization exception");
}
});
} Intelligent Assistant
Chat with our virtual assistant to get answers promptly.
Quick start
Helps you find desired resources with ease.