I am working on an android app and from last 2 weeks i am facing a issue in MI Phones that they don't receive Push Notification when application is in Background State or Inactive State. This is working great in other devices like samsung, micromax etc.
At last i solve it by Moving My application in Auto Start Mode through Device Permission Section
Security -> Permission Section -> Auto Start -> MY_APP -> Mark Toggle to On.
When i follow above steps i found that Facebook and whatsapp are already in AutoStart List, means it is possible to move an android application in AutoStart by code.
So can anybody please help me with some piece of code or Tutorials which i can follow to solve this issue.
You can use cordova-plugin-autostart by enabling autostart after boot
cordova.plugins.autoStart.enable();
If enabled is not called, then by default it will be disabled
cordova.plugins.autoStart.disable();
In the config.xml the following needs to be added
<gap:plugin platform="android" name="cordova-plugin-autostart" version="2.0.1" source="npm"/>
NOTE: Installation to the SD card will prevent the automatic start of your app after the boot
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With