android - how to run my service once in 30 minutes? -


can body me simple way run service once in half hour?

this not atall working can body how run once in half hour pls.

i use start app on system boot not working..?

i doing :

autostart.java

public class autostart extends broadcastreceiver  {     public void onreceive(context arg0, intent arg1)      {         intent intent = new intent(arg0,back_process.class);         arg0.startservice(intent);         log.i("autostart", "started");     } } 

back_process.java

 public class gps_back_process extends service     {         private static final string tag = "myservice";         @override         public ibinder onbind(intent intent) {             return null;         }         public void ondestroy() {              toast.maketext(this, "service stopped ..!", toast.length_long).show();             log.d(tag, "ondestroy");         }          @override         public void onstart(intent intent, int startid)         {             intent intents = new intent(getbasecontext(),mainactivity.class);             intents.setflags(intent.flag_activity_new_task);             startactivity(intents);             toast.maketext(this, "service started", toast.length_long).show();             log.d(tag, "onstart");         }     } 

thank you!

try :

private alarmmanager alarmmgr; private pendingintent alarmintent;  alarmmgr = (alarmmanager)context.getsystemservice(context.alarm_service); intent intent = new intent(context, alarmreceiver.class); alarmintent = pendingintent.getbroadcast(context, 0, intent, 0);  alarmmgr.set(alarmmanager.elapsed_realtime_wakeup,         systemclock.elapsedrealtime() +         60 * 1000, alarmintent); 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -