Search code examples
androidbroadcastreceiver

Android 10 BOOT_COMPLETED Broadcast not received to application


I have to run the service using BOOT_COMPLETED Broadcast but while the Android 10 device is booting I get the following warning.

system_process W/BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.LOCKED_BOOT_COMPLETED flg=0x400010 } to com.rahul.http/.BootReceiver

Mainifest:

 <service
        android:name=".HttpUpdateService"
        android:enabled="true"
        android:directBootAware="true"
        android:exported="true">
        
    </service>

    <receiver android:name=".BootReceiver"
        android:permission="android.permission.RECEIVE_BOOT_COMPLETED"
        android:exported="true"

        >
        <intent-filter android:priority="999">
            <action android:name="android.intent.action.BOOT_COMPLETED" />
            <action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" />

        </intent-filter>
    </receiver>

I have also added permission for receiving boot_complete broadcast.

<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>

I don't have any activity in my application.


Solution

  • try to add add android:directBootAware to your <receiver, as in DOCs