Page 1 of 1

Restart Android Service

PostPosted: Fri Sep 01, 2017 1:59 am
by Lena
I use this article for create Android Service:
How to use Android Service(TAndroidService) in C++Builder
How restart Android Service if device reboot?
Thanks.

Re: Restart Android Service

PostPosted: Fri Sep 01, 2017 6:24 pm
by rlebeau
You need to implement a BroadcastReceiver (in Java) to handle the BOOT_COMPLETED broadcast, then it can start your service. And you need to enable the RECEIVE_BOOT_COMPLETED permission.

Auto start Delphi XE5 Android App after boot
(This is written for Delphi, but you can adapt it to C++Builder)

Also be aware that BOOT_COMPLETED is not sent to an app until the user runs the app at least once (to avoid malware running on bootup). And if the user does a Force Close on the app, it will not receive BOOT_COMPLETED anymore until the user runs the app again at least once.