Reputation: 39807
I am not trying to create a BOOT_COMPLETED receiver (and doing so would not solve my problem).
Is there a way to determine if BOOT_COMPLETED has occurred? I have a library which is being called before (as well as after) Android has finished booting, and I do not want my library to complete its request if the system has not finished booting. Setting up a BOOT_COMPLETED receiver in every application that may use this library is not a reasonable approach for several reasons.
Are there any Android calls I can make to determine if the device's boot has completed? It appears that there is a property, dev.bootcomplete, which I may have to use if no better method exists.
Upvotes: 3
Views: 2665
Reputation: 28093
Setting up a BOOT_COMPLETED receiver in every application
I guess you mean to say you dont want BOOT_COMPLETED receiver in each activity .
Its very much possible.
You can register BOOT_COMPLETED receiver
for Activity A
.and once Activity A
a gets broadcast it can notify other activities using sendBroadcast (custom broadcast).
To see how to use custom broadcast look here
Upvotes: 1
Reputation: 28464
I'm afraid the only official way of achieving this is to create RECEIVE_BOOT_COMPLETED
receiver.
I would advise you not to rely on properties, since they often are OEM specific. Otherwise you may end up with your application working on one Android model, but not another.
Upvotes: 3