I am confused about the a concept here. I read on many tutorials that in order to get notified when device has booted (say for purpose of re-scheduling an alarm), you need to have a boot_completed broadcast receiver.
However the confusing part is that no where I see a method like “register(boradcast receiver)”. People just have the broadcast receiver class and they have it in manifest. but dont you need some sort of registration process? How will the system know that there is an APP x who has a broadcast receiver y listening for boot events unless explicitly told through registering
Sort of like you create click listener, but you need to register/add it to the button to so it gets called upon clicked.
Can someone clear the confusion for me?
Thank you
Thanks
The
<receiver>element in the manifest has the<intent-filter>child element, documenting theIntentstructure it wishes to receive:Here, we are registering a
BroadcastReceiver, namedOnBootReceiver, to receiveBOOT_COMPLETEDbroadcasts.Android is “explicitly told through registering”. It just so happens that the “registering” is done via the manifest, not via Java code in the app.