Loading...

Why can't I get token in response of Huawei Push Kit?

Answer #1 100 %

why response HmsInstanceId.getInstance always empty. in first time token comes to onNewToken, but why always String token = HmsInstanceId.getInstance(MainActivity.this).getToken(appId, "HCM"); empty and how I could get this token?

The device EMUI version is earlier than 10 returns null, and then the token is returned from the onNewToken callback. You can refer this Docs.

enter image description here

token assigned to the phone, but if my app has two users, how I could assign token fore each user in one app?

Huawei Push tokens are associated with devices and do not differentiate users. However, you can bind a user to a token based on your service. I don't know what your specific application scenario is. Maybe you can try to getToken every time you log in and deleteToken every time you log out.

You’ll also like:


© 2023 CodeForDev.com -