Push Notification issues on some smartphones

Mike1970

Well-Known Member
Licensed User
Longtime User
Hi everyone,

do you ever experienced issues related to the reliability of the notifications on Android?
I mean, i noticed that on some devices the notifications are not shown everytime, meanwhile, on others they reliably show up at everytime i send them.

Personally i found this problem on chinese phones, where you have to manually go in to the phone settings and disable some sort of restriction that is enabled by default, only after this the notifications are showed correctly.

Video that explain how to turn off that setting:

Other infos
 

DonManfred

Expert
Licensed User
Longtime User
It is a known Issue.
 

Mike1970

Well-Known Member
Licensed User
Longtime User
It is a known Issue.
And there is a known workaround for this?

I found this at the end of the page I linked:
The good news is that in order to not kill itself or others, Huawei/Honor’s services, before killing an app, hwPfwService looks at the tag of the wakelock and if the tag is one the hard-coded whitelisted tags, it does not kill the app. The whitelisted wakelock tags are: “AudioMix”, “AudioIn”, “AudioDup”, “AudioDirectOut”, “AudioOffload” and “LocationManagerService”.
Here is how you can workaround this in code:
B4X:
String tag = "com.my_app:LOCK";

if (Build.VERSION.SDK_INT == Build.VERSION_CODES.M && Build.MANUFACTURER.equals("Huawei")) { tag = "LocationManagerService"; }

PowerManager.WakeLock wakeLock = ((PowerManager) getSystemService(Context.POWER_SERVICE)).newWakeLock(1, tag); wakeLock.acquire();

but i'm not pretty sure about what is that and how to use it in B4A
 
Top