Each time I start a new debug instance, my accessibility service resets to the disabled state.
Is there any way to keep it enabled across successive debug runs (as it is
This might go some way to explain and mitigate your problem (but not what causes your Force stop
).
After Android 3.1
" the system sets FLAG_EXCLUDE_STOPPED_PACKAGES
on all broadcast intents." So after 3.1 , all apps are stopped on boot. Why ?. For security reasons.
There are RULES to turn the flag off FLAG_EXCLUDE_STOPPED_PACKAGES
.
(1) If the app get's a Force stop
from settings OR unresponsive app
button, the flag is set.
(2) Your app needs to be in Phone Storage
, NOT external storage
(e.g. sdcard
) otherwise the flag set. The BOOT_COMPLETE
is sent before external storage is mounted. So, if app is installed to external storage it won't receive BOOT_COMPLETE broadcast message.
(3) If the application has never been run, the flag is set (never is relative to current boot state ;O) NEVER means in THIS boot OR you invalidated the flag in the last boot state).
A quick way (scripted if you like) to re-enable your service after Force stop
assuming BOOT_COMPLETED
receiver (I'm guessing you have this, because your fine after reboot):
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"
adb shell am broadcast -a android.intent.action.BOOT_COMPLETED
See launchcontrols