I am developing a push notifcation application using Expo on managed API’s, and I am currently testing on Android.
When the application is on the background, It receives notifications on the first 5 minutes only
and then does not receive any despite the server is sending.
I openned the Apps settings on andriod and found an Application like FaceBook messenger has the autostart turned
on by default, so I changed my Application autostart manually to be ON, then the Application receives
the notification all the time without a problem.
So the question here How to ask a permission to make the application autostart automatically like facebook messenger ?
so that I can always receive the notifications ?
as Per the Documentation example for registerForPushNotificationsAsync, on the Application startup I ask for Permissions.NOTIFICATIONS
then send the Expo Notification token to my server.
@adamjnav thank you for the reply.
I only tested on one device (Xiaomi MI MAX 2) Android version is v7.1.1 (Noga), but I can check on another device tomorrow.
@adamjnav Today I tested on another android device and it’s working without interruption
today test was on Honar 7c android 8 Oreo.
and In the settings it does not have the autostart option, I can receive the notification when the app is in background or completely closed without a problem.
On the MI MAX 2 phone the app is by default has the autostart off. and it has the problem that it stops receiving the notification after a while of non activity.
I have to turn the autostart manually ON so that it will not stop receiving the notifications.
@rickparrish, Nice thank you, However I do not want the user to get bothered changing the settings himself. I would like the App. to automatically configure itself (with javascript) to be either “Auto Started” or “Battery Saver Not restricted”. Do you know a solution for this like asking for permissions ?
@amrlsayed Sorry, I’m not aware of a solution (and would also be interested if there was one!)
Since it’s something specific to MIUI, I’m guessing there probably isn’t a permission for it though, so we’re stuck with educating users why they should never buy another Xiaomi device…