Good day. I set up the BroadcastReceiver in the application, but after a couple of days it stopped working on the Asus Zenfone 2 device, with this on the virtual device everything works fine.

public class TestReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Log.d("OLOLO", "Received!!!"); } 

The task is visible in the list

 adb shell dumpsys alarm Batch{24a04b21 num=8 start=25890261 end=26084096}: RTC_WAKEUP #7: Alarm{2baa3b46 type 0 when 1459344120226 com.test.daily} tag=*walarm*:com.test.daily/.alarm.TestReceiver type=0 whenElapsed=+58m18s890ms when=2016-03-30 22:22:00 window=-1 repeatInterval=0 count=0 operation=PendingIntent{13aec107: PendingIntentRecord{32a28234 com.test.daily broadcastIntent}} isUltraPowerSavingApp=false callingUid=10184 wakeup=true isNotAffectByListAlarm=false +13ms 4 wakes 4 alarms: *walarm*:com.test.daily/.alarm.TestReceiver 

Manifest:

 <application> <activity android:name=".MainActivity" android:label="@string/app_name" android:screenOrientation="portrait" android:theme="@style/AppTheme.NoActionBar"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <receiver android:name=".alarm.TestReceiver" android:process=":remote" /> </application> 
  • Maybe the device was rebutted? - Android Android
  • rebutted, added alarm on a new one - nothing helps. when the set time comes, the line + 13ms 4 wakes 4 alarms: walarm : com.test.daily / .alarm.TestReceiver changes, but the receiver itself does not work - I. Shelkovnikov
  • but show me how you register pendingIntent - Android Android

1 answer 1

Understood - it turns out, in the startup manager on the phone (power section) you had to add the application to the allowed ones. Previously, it was definitely not there, perhaps the problem appeared after some update of the phone or applications.