java - BroadcastReceiver (TIME_TICK) dies every night? -


i want write kind of background-live-ticker app sports-web-services... app able call time_tick time.

btw: tried use alarmmanager, problem same.

but problem...

i use receiver service execution part. receiver called every minute correctly after register. every night service terminated , never called again.

on android 2.x works fine android 4.x stop receiver every day... there posibility keep app alive on android 4.x?

the reveiver registered in main-activity:

registerreceiver(new myreceiver(), new intentfilter(intent.action_time_tick)); 

manifest-entries:

<service android:name="de.pepdev.myservice" /> <receiver android:name="de.pepdev.myreceiver">     <intent-filter>         <action android:name="android.intent.action.time_tick" />     </intent-filter> </receiver> 

receiver-class:

public class myreceiver extends broadcastreceiver {     public static   long        nextexectime    = 0;     public static   calendar    currenttime     = calendar.getinstance();      @override     public void onreceive(context context, intent intent)     {         currenttime = calendar.getinstance();          if(nextexectime <= currenttime.gettimeinmillis())         {             intent service = new intent(context, myservice.class);             context.startservice(service);         }     } } 

i tried use alarmmanager, problem same

alarmmanager far better answer action_time_tick, particularly if let user configure polling frequency (including option "never poll, please, battery , bandwidth usage stay low").

please feel free ask separate stackoverflow question regarding whatever problems feel experiencing it.

but every night service terminated , never called again

android can , terminate process @ point, either user request or due old age.

manifest-entries:

the <receiver> pointless, you cannot register action_time_tick via manifest.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -