| CLASS info |
| public class SafetyDetect extends java.lang.Object |
| Obtains the main entry point for the Safety Detect service. |
| Return type | Method 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. |
| 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. |
| Parameter name | Parameter desc |
| context | Context of an Android app. |
Return
| type | desc |
| SafetyDetectClient | Main 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). |
| Parameter name | Parameter desc |
| activity | Activity of an Android app. |
Return
| type | desc |
| SafetyDetectClient | Main entry point for the Safety Detect service. |