HMS-Core / hms-react-native-plugin

This repo contains all of React-Native HMS plugins.
https://developer.huawei.com/consumer/en/doc/overview/HMS-Core-Plugin?ha_source=hms1
Apache License 2.0
241 stars 68 forks source link

[@hmscore/react-native-hms-push] getToken Error / Exception #217

Closed bulkinav closed 1 year ago

bulkinav commented 2 years ago

Description

I trying get Push token as described in https://developer.huawei.com/consumer/en/doc/HMS-Plugin-Guides/apptoken-0000001050157797-V1, but evey time get the error.

I also builded an example from https://github.com/HMS-Core/hms-react-native-plugin/tree/master/react-native-hms-push/example (I changed package ID to registered in AppGallery Connect and added agconnect-services.json), but after press the button "Get Token" the error message appeared again.

Expected behavior

Display alert with Token

Current behavior

Display alert with error message:

[getToken] Error/Exception: {"framesToPop": 1, "nativeStackAndroid": [], "userInfo": null, "code": "907122045", "line": 15, "column": 1745, "sourceURL": "index.android.bundle"}

Screenshots

Screenshot-2022-08-14-at-19-53-33.jpg

Logs

Logs from logcat:

I/HMSSDK_HmsMessageService: start to bind
I/HMSSDK_HmsMessageService: handle message start...
I/HMSSDK_HmsMessageService: onNewToken
 I/HMSSDK_HmsMessageService: doOnNewToken:transactionId = null , internalCode = 907135000,subjectId:null,proxyType:null
I/HMSSDK_HmsMessageService: Apply token failed, subId: null
I/HMSSDK_HmsMessageService: onTokenError to host app.
I/HMSSDK_HmsMessageService: onTokenError to host app with bundle.
I/HMSSDK_HmsMessageService: start to destroy

Environment

Huawei Nova i5 HMS Core 6.6.0.332 @hmscore/react-native-hms-push: 6.5.0-300

System: OS: macOS 12.5 Shell: 3.2.57 - /bin/bash Binaries: Node: 18.5.0 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 8.5.5 - /usr/local/bin/npm Watchman: 2022.07.04.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5 Android SDK: API Levels: 28, 29, 30, 31 Build Tools: 28.0.3, 30.0.2, 30.0.3, 31.0.0, 32.0.0 IDEs: Android Studio: Chipmunk 2021.2.1 Patch 2 Chipmunk 2021.2.1 Patch 2 Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild Languages: Java: 1.8.0_312 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: 0.67.4 => 0.67.4 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Other Add any other context about the problem here

orhanoksuzz commented 2 years ago

i am having the same problem.I think there is a problem with this version.

Edit: It started working after the hms core and emui update on my device.

Xuejiao-Shi commented 2 years ago

@bulkinav @orhanoksuzz

  1. Check by referring to this documents(Especially Step 3.d) and whether the AppGallery Connect configuration is correct.
  2. Check whether appid in the agconnect-services.json file matches the package name. You can download a new JSON file.
  3. The problem may be caused by the cache of the HMS Core (APK). Uninstall and update the HMS Core (APK), disconnect the network, connect the HMS Core (APK), and start the application again.
  4. If the problem persists, provide a complete log for us to check.