Pavan Ghanate
Pavan Ghanate

Reputation: 121

Cannot get token from Huawei HMS push kit

error message as below

[getToken] Error/Exception: {"nativeStackAndroid":[],"userInfo":null,"message":"907122036: no right","code":"907122045","line":2568,"column":45,"sourceURL":"http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.huaweipush.letsapp&modulesOnly=false&runModule=true"}

Upvotes: 1

Views: 1350

Answers (2)

Sivaraj
Sivaraj

Reputation: 171

Here below is some checkpoints for the above issue.

  1. First ensure you have enabled the push kit in AppGallery Console

  2. Please check whether you are providing correct app id or not:

    String appId = AGConnectServicesConfig.fromContext(MainActivity.this).getString("client/app_id"); pushtoken = HmsInstanceId.getInstance(MainActivity.this).getToken(appId, "HCM");

  3. It is recommended that the getToken method be called in the onCreate method of the first Activity class after app startup. Implement the corresponding listeners for getToken API and observe the logs.

  4. Device: Non-Huawei phones must have HMS Core (APK) installed (which can be downloaded from HUAWEI AppGallery). There is no restriction on Huawei phones.

  5. Network: The phone is connected to the network and the connection is stable.

  6. EMUI version: EMUI 4.0 and EMUI 4.1 (for some devices), and EMUI 5.0 or later It is recommended that you use a device running EMUI 5.0 or later.

Upvotes: 1

zhangxaochen
zhangxaochen

Reputation: 34047

[getToken] Error/Exception: {"nativeStackAndroid":[],"userInfo":null,"message":"907122036: no right","code":"907122045","line":2568,"column":45,"sourceURL":"http://localhost:8081/index.bundle?platform=android&dev=true&minify=false&app=com.huaweipush.letsapp&modulesOnly=false&runModule=true"}

The error code indicates that the Push Kit are not enabled. As a result, have no permission to obtain the token. How to enable the Push Kit, pls refer to the this docs.

  1. Sign in to AppGallery Connect and click My projects. enter image description here

  2. Find and click the desired project in the project list, and click the app for which you need to set Push Kit parameters. enter image description here

  3. Go to Project settings > Manage APIs and enable Push Kit. enter image description here

  4. Go to Grow > Push Kit and click Enable now. In the dialog box that is displayed, click OK. enter image description here

  5. Enable the precise messaging function. enter image description here

Upvotes: 2

Related Questions