2

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.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Ajmal Khan
  • 33
  • 4

1 Answers1

1

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.

Community
  • 1
  • 1
Moises Jimenez
  • 1,962
  • 3
  • 21
  • 43