android - Receiver doesn't work after restart -
after restart or turn on device receivers don't working. when don't restart or turn on device working...
manifest:
<receiver android:name=".alarmreceiver"> <intent-filter> <action android:name="android.intent.action.boot_completed" /> </intent-filter> </receiver> <receiver android:name=".actionreceiver"> <intent-filter> <action android:name="android.intent.action.boot_completed" /> </intent-filter> </receiver>
broadcastreceiver:
public void onreceive(context context, intent intent) { string msg=intent.getstringextra("msg"); string note=intent.getstringextra("note"); intent startintent = new intent(context, alarmdialog.class); startintent.putextra("msg",msg); startintent.putextra("note",note); startintent.addflags(intent.flag_activity_new_task); context.startactivity(startintent); }
activity:
intent intent = new intent(addone.this,alarmreceiver.class); intent.putextra("msg", title.gettext().tostring()); intent.putextra("note", note.gettext().tostring()); alarmmanager alarmmgr=(alarmmanager)getsystemservice(context.alarm_service); pendingintent alarmintent = pendingintent.getbroadcast(getapplicationcontext(), id, intent, pendingintent.flag_update_current); alarmmgr.set(alarmmanager.rtc_wakeup, calendar.gettimeinmillis(), alarmintent);
Comments
Post a Comment