目录

CLASS info
public class SafetyDetect extends java.lang.Object
Obtains the main entry point for the Safety Detect service.

Public Method Summary

Return typeMethod name
static SafetyDetectClient

getClient(android.content.Context context) 

Returns a SafetyDetectClient object, which is used to call the Safety Detect APIs.

static SafetyDetectClient

getClient(android.app.Activity activity) 

Returns a SafetyDetectClient object, which is used to call the Safety Detect APIs.

Public Methods

Method
public static SafeteDetectClient getClient (android.content.Context context)

Returns a SafetyDetectClient object, which is used to call the Safety Detect APIs.

Note:
This method is used to obtain a SafetyDetectClient instance for calling Safety Detect APIs. If the passed parameter is not of the Activity type and an error occurs when the SafetyDetectClient instance is used to call Safety Detect APIs, the app only returns an error code but does not display the interaction UI to prompt the user to handle the error. For example, if HMS Core (APK) is not in a version required for Safety Detect, the app returns the error code 907135003. In this case, the user needs to manually update HMS Core (APK). To show the update wizard, you are advised to pass a parameter of the Activity type instead of the Context type to create a SafetyDetectClient instance.
Parameters
Parameter nameParameter desc
contextContext of an Android app.


Return

typedesc
SafetyDetectClientMain entry point for the Safety Detect service.
Method
public static SafeteDetectClient getClient (android.app.Activity activity)

Returns a SafetyDetectClient object, which is used to call the Safety Detect APIs.

Note:

This method is used to obtain a SafetyDetectClient instance for calling Safety Detect APIs. If the input parameter is of the Activity type and an error occurs when the SafetyDetectClient instance is used to call Safety Detect APIs, the app displays the interaction UI to prompt the user to handle the error. For example, if HMS Core (APK) is not in a version required for Safety Detect, the app displays the UI to prompt the user to update HMS Core (APK).


Parameters
Parameter nameParameter desc
activityActivity of an Android app.


Return

typedesc
SafetyDetectClientMain entry point for the Safety Detect service.