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.

Only Essential Cookies
Accept All
GuidesSystemSecurityDevice Security KitAnti-Fraud PickerObtaining Fraudulent Apps

Obtaining Fraudulent Apps

Use Cases

An app calls the API of Device Security Kit to obtain fraudulent app information for anti-fraud purposes, such as reporting fraudulent apps.

Constraints

Currently, this capability is supported only on phones and tablets. It is available only to anti-fraud apps.

Service Process

Process description:

  1. A user selects the function of reporting fraudulent apps in your app.

  2. Your app calls the API of Device Security Kit to start the fraudulent app picker.

  3. The user selects fraudulent apps in the fraudulent app picker.

  4. Device Security Kit calls the callback function to notify your app of the selection result. Your app then processes the service based on the fraudulent app information.

API Description

The following table lists the API for obtaining fraudulent apps. For more information about the API, please refer to API Reference.

Expand
API Description
selectFraudApp(context: common.Context, options?: AntifraudAppOptions): Promise<AntifraudAppResult> Obtains fraudulent app information.

Development Procedure

NOTE
  • When preparing for the development, you need to apply for the ohos.permission.USE_FRAUD_APP_PICKER permission.

  • Only apps in the trustlist can apply for this permission. For details about how to apply for this permission, please refer to Requesting Restricted Permissions.

  • You need to inform users about the purpose, methods, and scope of data usage.

  1. Import the Device Security Kit module and related public modules.

    Collapse
    Word wrap
    Dark theme
    Copy code
    1. import { BusinessError } from '@kit.BasicServicesKit';
    2. import antifraudPicker from '@hms.security.antifraudPicker';
    3. import hilog from '@ohos.hilog';
    4. import { common } from '@kit.AbilityKit';
  2. Call the selectFraudApp API to obtain the fraudulent app information.

    Collapse
    Word wrap
    Dark theme
    Copy code
    1. const TAG = 'AntifraudPickerJsTest';
    2. // Request to obtain the fraudulent app information and process the service.
    3. let options: antifraudPicker.AntifraudAppOptions = {
    4. maxSelectNumber: 5
    5. };
    6. try {
    7. hilog.info(0x0000, TAG, 'SelectFraudApp begin.');
    8. let context = this.getUIContext().getHostContext();
    9. const result: antifraudPicker.AntifraudAppResult = await antifraudPicker.selectFraudApp(context, options);
    10. } catch (err) {
    11. let e: BusinessError = err as BusinessError;
    12. hilog.error(0x0000, TAG, 'SelectFraudApp failed: %{public}d %{public}s', e.code, e.message);
    13. }
Search in Guides
Enter a keyword.