android - AlarmManager doesn't trigger a WakefulBroadcastReceiver -


i'm trying launch intent service using alarmmanager , wakefulbroadcastreceiver. can launch service using sendbroadcast() , works should, can't launch alarmmanager.

the code launching this:

@override protected void onpause() {     super.onpause();      alarmmanager = (alarmmanager)getsystemservice(alarm_service);     intent = new intent(this, notifier.class);     pendingintent pi = pendingintent.getservice(this, 0, i, 0);      am.set(rtc_wakeup, system.currenttimemillis(), pi); } 

the notifier class this:

public class notifier extends wakefulbroadcastreceiver {     @override     public void onreceive(context context, intent intent)     {         log.i("notifier", "onreceive()");         componentname comp = new componentname(context.getpackagename(), notifierservice.class.getname());         startwakefulservice(context, (intent.setcomponent(comp)));     } } 

and notifierservice this:

public class notifierservice extends intentservice {     private static final string tag = "notifservice";      public notifierservice()     {         super("notifierservice");    }      @override     protected void onhandleintent(intent intent)     {         log.i(tag, "notifierservice: handling intent");     } 

the manifest has these:

<service android:name=".notifierservice" /> <receiver android:name=".notifier" /> 

why doesn't alarmmanager trigger receiver?

change:

intent = new intent(this, notifier.class); 

to:

intent = new intent(this, notifierservice .class); 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -