Forum Xamarin.Android

Start service on boot with no activity

BrambleBramble Member
edited October 2019 in Xamarin.Android

- Background service running all of the time
- Starts on boot but
- Has no activities/ui.
- Lollipop)

I've seen a few posts which say that there are security restrictions which mean that broadcast receivers will not work until the application has been 'launched' at least once. These posts appear to be debated by others who say the broadcast receiver should work regardless.

Q2) Is this true? Can anybody direct me to the relevant documentation?
Q2) If this is true, could the application service be started for the first time only from another application, and would this activate the BOOT_COMPLETED broadcast receiver?



  • MBatMBat Member ✭✭

    I am looking into Foreground service , is sound better if you don't mind the notification ?

  • JarvanJarvan Member, Xamarin Team Xamurai

    would this activate the BOOT_COMPLETED broadcast receiver

    To make the broadcastReceiver run when the device reboots.

    1.Make sure you've added boot permissions
    [assembly: UsesPermission(Manifest.Permission.ReceiveBootCompleted)]

    2.Add the manifest entry via attributes:

    [BroadcastReceiver(Enabled = true)]
    [IntentFilter(new[] { Intent.ActionBootCompleted })]    
    public class BootBroadcastReceiver : BroadcastReceiver
Sign In or Register to comment.