please explain me, 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?
new Thread() {
@Override
public void run() {
try {
String appId = AGConnectServicesConfig.fromContext(MainActivity.this).getString("client/app_id");
String token = HmsInstanceId.getInstance(MainActivity.this).getToken(appId, "HCM");
} catch (Exception e) {
}
}
}.start();
and maybe second question: token assigned to the phone, but if my app has two users, how I could assign token fore each user in one app?
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.
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.