General Open BOOT_COMPLETED BroadcastReceiver

General topics about the Android-Platform itself.
Coding issues please to the subforum right below.

Would you like one open BOOT_COMPLETED BroadcastReceiver?

No votes
Total votes : 1

General Open BOOT_COMPLETED BroadcastReceiver

Postby MrSnowflake » Wed Dec 10, 2008 3:36 pm

I have been thinking: What happens when your phone has 100+ (ok the number is a bit big) BroadcastReceivers listening to the BOOT_COMPLETED intent. That would make booting your phone slow like hell. Even without the starting of Services.
So my sollution would be to make a BroadcastReceiver, to which other developers can register their Service, which they want to start at boot. This will make the system start 1 BroadcastReceiver instead of the 100+ and dramatically lowering boot time.

Services should be registered using a ContentProvider if a Service is in it (it's intent that is), the OpenBootReceiver will launch it. Simple as that.
Another major advantage is: it is very simple to not have your Service started, just remove it from the ContentProvider and you are done, whereas with the normal approach, your BroadcastReceiver will always be started, as you can't unregister it!

Ofcourse, this simple approach will only make it possible to start the Service and not check for any condition, so this should be done in the Service itself OR you should still make your own BroadcastReceiver. But I think most such checks could be done inside the Service itself.

What is your opinion about this? Do you think this is usefull or not? Would you use it? Any further sugestions?

Thanks in advance!

[edit]Added the other "major advantage".
User avatar
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium


Return to General

Who is online

Users browsing this forum: No registered users and 4 guests