Description
Hello!
We've recently implemented the Huawei Push Kit in order to be able to send notifications to Huawei Devices with no Google Play Services available and it seems to be working just fine in the emulator and for several real users, but for the last 30 days we had ~750 cases with the error from the title.
Here is the stacktrace which Sentry is returning to us:
This is how I call the turnOnPush method:
And sometimes, in the onError callback, we receive the following error: type 'PlatformException' is not a subtype of type 'String'. I believe it is somehow connected with the failure of calling the turnOnPush().
And this is how we decide to either launch FCM or HMS Push Kit:
if (Platform.isAndroid) {
HmsApiAvailability hmsClient = HmsApiAvailability();
int hmsStatus = await hmsClient.isHMSAvailable();
GooglePlayServicesAvailability gmsStatus = await GoogleApiAvailability
.instance
.checkGooglePlayServicesAvailability();
//gms and hms are available
if (gmsStatus.value == 0 && hmsStatus == 0 ||
(gmsStatus.value == 0 && hmsStatus != 0)) {
//Then initialize Firebase Cloud Messaging
await initFirebaseCloudMessaging();
}
//gms is unavailable, but hms is available
else if ((gmsStatus.value == 1 ||
gmsStatus.value == 4 ||
gmsStatus.value == 5 ||
gmsStatus.value == 6 ||
gmsStatus.value == 7) &&
hmsStatus == 0) {
//Then initialize HMS Push Kit
await initHMSPushKit();
}
//gms is unavailable and we have errors with hms
//(e.g. old version/unoficial version/ service is installed but unavailable)
else if ((gmsStatus.value == 1 ||
gmsStatus.value == 4 ||
gmsStatus.value == 5 ||
gmsStatus.value == 6 ||
gmsStatus.value == 7) &&
(hmsStatus == 1 ||
hmsStatus == 2 ||
hmsStatus == 3 ||
hmsStatus == 9)) {
// then fire up the getErrorDialog which depends on the hmsStatus code
hmsClient.getErrorDialog(hmsStatus, 1000, false);
//and then initialize hms push kit
await initHMSPushKit();
}
} else {
await initFirebaseCloudMessaging();
}
Expected behavior
Consistent way of enabling push kit. I'm willing to share any other info if you need it
Hello @gidrokolbaska
A new version of huawei_push has been released. It's suggested to use this version.
If the problem still occurs, please do not hesitate to write to us.
Description Hello! We've recently implemented the Huawei Push Kit in order to be able to send notifications to Huawei Devices with no Google Play Services available and it seems to be working just fine in the emulator and for several real users, but for the last 30 days we had ~750 cases with the error from the title.
Here is the stacktrace which Sentry is returning to us:
Everything is configured correctly as per https://developer.huawei.com/consumer/en/doc/development/HMS-Plugin-Guides/config-agc-0000001050178043, otherwise it wouldn't have worked on emulator
This is how I call the turnOnPush method: And sometimes, in the onError callback, we receive the following error: type 'PlatformException' is not a subtype of type 'String'. I believe it is somehow connected with the failure of calling the turnOnPush().
And this is how we decide to either launch FCM or HMS Push Kit:
Expected behavior Consistent way of enabling push kit. I'm willing to share any other info if you need it
Environment