Application stops receiving Push Notifications after a while

Hi Guys,

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.

I am using Managed Expo Application on

expo “sdkVersion”: 32.0.0,
expo-cli: 2.7.0,
react-native: sdk-31.0.0

Thanks,

Hey @amrlsayed,

Have you tried testing on a different device? Also, can you let me know what device, OS version this is occurring on?

Cheers,
Adam

@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.


It’s OS is MIUI Global 10.2.

I’ve never played with the Auto Start setting, instead I change Battery Saver to Not Restricted, and that seems to do the trick as well.

(the option is on the same screen as your screenshot, just need to scroll down a bit)

@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…

1 Like

@rickparrish , Hahaha yes would be :slight_smile:
Thank you, no problem.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.