Broadcast receiver does not work after reboot

I have a broadcast receiver registered in the manifest to intercept calls, for example:

    <receiver android:name="CallTracker">
        <intent-filter>
            <action android:name="android.intent.action.PHONE_STATE" />
        </intent-filter>
    </receiver>

Everything is working fine and the receiver is receiving a call. But after restarting the device or my AVD, the receiver is no longer called.

What do I need to do to get my broadcast receiver to work after reboot? Do I need a PackageManager for this? I like registering in the manifest, since the application does not have to be active so that the application can intercept the call.

+3
source share
2 answers

You need to add this action to your intent filter.

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

-1
source

, , , , . , 1806772 , :

, , . ( ), . .

0

Source: https://habr.com/ru/post/1793957/


All Articles