Broadcast Regression Confirmed
In a previous post, I cited evidence that the
BOOT_COMPLETED broadcast will not work out of the box on Android 3.1 until the user uses your app.
It’s actually somewhat bigger than that.
In the issue that I filed seeking clarification, Ms. Hackborn indicated:
Starting with 3.1 when applications are installed they are in a “stopped” state so they will not be able to run until the user explicitly launches them. Pressing Force Stop will return them to this state.
As a result, when applications are first installed, they are totally ignored by the system until and unless the user manually launches something: clicking on a launcher activity or adding an app widget, most likely.
Developers who had been relying upon getting some sort of system broadcast without user intervention will need to adjust their apps for Android 3.1.
As I wrote in the previous post:
I expect that most apps will be OK. For example, if your boot receiver is there to establish an
AlarmManagerschedule, you also needed to establish that schedule when the app is first run, so the user does not have to reboot their phone just to set up your alarms. That pattern doesnot change – it’s just that if the user happens to reboot the phone, it will not set up your alarms, until the user runs one of your activities.
UPDATE: To clarify the above quote, once the user runs the app for the first time (and does not Force Stop it), everything behaves as before — a reboot will cause
BOOT_COMPLETED broadcasts to be received and so on. However, if the user installs the app, until and unless they run the app manually, no broadcasts will be received. And if the user force-stops the app, until and unless they run the app manually, no broadcasts will be received.
This change is not terribly shocking, as it ratchets up the security another notch by limiting ways malware can run without user knowledge. While it does not offer perfect security — the malware can still install its own copy of an Angry Birds launcher icon and hope users screw up — it is an improvement.
IMHO, the biggest issue is that this change went out unannounced
UPDATE: A Twitter follower pointed out that this change was documented in the 3.1 release notes, which I had missed.Tweet