1

I have an application which runs a service continuously in the background even after restarting the device for this, I have used below receivers,

 <action android:name="android.intent.action.BOOT_COMPLETED" />
            <action android:name="android.intent.action.QUICKBOOT_POWERON" />
            <action android:name="com.htc.intent.action.QUICKBOOT_POWERON" />
<action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" />

It was working fine till Android Oreo But in Android Pie, Service is not getting started until Phone is unlocked.

to start service after restart phone needs to be unlocked.

What is the solution to start service without unlocking the phone after the restart

Amin Pinjari
  • 2,129
  • 3
  • 25
  • 53

1 Answers1

0

I believe you are looking for

<action android:name="android.intent.action.LOCKED_BOOT_COMPLETED"/>

and also add to your receiver in the manifest:

android:directBootAware="true"

This action is sent by the device before the user unlocks their phone on restart. Check out:

https://developer.android.com/training/articles/direct-boot

JMC_CMJ
  • 53
  • 5