BroadcastReceiver not working when app is installe

2020-05-08 08:12发布

问题:

I am creating a EventsManager app in which i have a BroadcastReciver which executes for BOOT_COMPLETED broadcast.this receiver has been used to re-register all the events with AlarmManager.If the app is installed on phone's memory the it works fine but in the case of sd card BOOT_COMPLETED broadcast is not being delivered to broadcast receiver. pls help..

回答1:

Quoting the documentation:

In order for your application to consistently behave as expected, you should not allow your application to be installed on the external storage if it uses any of the following features... The system delivers the ACTION_BOOT_COMPLETED broadcast before the external storage is mounted to the device. If your application is installed on the external storage, it can never receive this broadcast.

Hence, you cannot allow your app to be installed to external storage.