Why might HmsInstanceId.deleteToken and HmsInstanceId.getToken not work?

Viewed 82

On some devices, HmsInstanceId.deleteToken throws "com.huawei.hms.common.ApiException: 907135000: arguments invalid" while HmsInstanceId.getToken returns an empty string?

I have several huawei devices without google services on which this problem does not reproduce (eg JNY-LX1 ENUI 10.1.0). That is, on them I successfully receive a new token and receive notifications.

And there is, for example, a mediapad T5 EMUI 8.0.0 device (both with Google services and with HMS Core at the same time), on which so far it has not been possible to get either HmsInstanceId.deleteToken or HmsInstanceId.getToken to work successfully. I tried to install different versions of HMS Core on phones (I'm currently testing on 6.6.0.311). Judging by the description, my problem is very similar to https://github.com/HMS-Core/hms-push-clientdemo-android/issues/6, but the comments from there did not help me at all.

2 Answers

Update:

Check whether the system version is earlier than EMUI 10.0.

If the EMUI version of a Huawei device is earlier than 10.0, the token is returned through the onNewToken(String token, Bundle bundle) method. For details, kindly refer to this docs.


The problem may be caused by the cache of the HMS Core (APK). Try to uninstall the HMS Core (APK) and update it may solve this issue. If the problem persists, pls provide a detailed log for us to check.

The developer FAQ states that this exception might be caused by a configuration issue with your agconnect-services.json. The json you posted is missing a region key/value. It might be a really basic thing, but I recommend checking that your data storage location has been configured properly. After you set the data storage location, you will need to redownload the agconnect-services.json. https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-Guides/faq-0000001078017900

Related