Proximity alerts do not work after phone reboot

I use proximity alerts in one of my applications, however it seems that whenever I reset my phone (via battery) or just generally, proximity alerts are no longer active.

The only way they work again is to uncheck the box (which removes and then re-adds the proximity alert)

Any idea or reason?

+1
source share
1 answer

You must reset alerts. Android OS does not support your warnings on reboot, up to your application. Create a BroadcastReceiver (I named my BootReceiver in my example below) to handle the android.intent.action.BOOT_COMPLETED action (this is defined in the manifest). With BroadcastReceiver, you can restart all your alerts. Do not forget to add permission "android.permission.RECEIVE_BOOT_COMPLETED".

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> ... <receiver android:name=".BootReceiver"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> </intent-filter> </receiver> 
+3
source

Source: https://habr.com/ru/post/1434702/


All Articles