Android - Starting a Service on Boot

242 views Asked by At

I'm trying to start an Android Service on Boot that entails starting advertisements on boot which can be read by a BLE scanner. Do you know how to go about doing so? Currently, I keep getting "Unfortunately, 'myService' has stopped." Note: I am using Xamarin for Android development.

1

There are 1 answers

0
Moises Jimenez On

In order to do this you need to register a BroadcastReceiver for the system intent "android.intent.action.BOOT_COMPLETED" on your Android manifest. However, if your application is installed on the external storage use "android.intent.action.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE". From this BroacastReceiver you can then start your Service.

There's a nice tutorial here that should meet your needs. Also check this other SO question which has a detailed explanation on the subject.