Android Service doesnt restart by itself -


in application have activity , service (extends intentservice ). service's onstartcommand looks below

@override public int onstartcommand(intent intent, int flags, int startid) {     super.onstartcommand(intent, flags, startid);     return start_redeliver_intent; } 

my onhandleintent method:

@override protected void onhandleintent(intent intent) {    while(continueloop){ //continueloop controlled binder           //do stuff    } } 

i bind service activity, can break infinite loop. started app , it's service, , started other applications, after while activity got stopped , destroyed, service. when close other applications using task manager , service doesn't start itself.

i waited , launched app, activity launched service started. thought android system restart service automatically when memory available. missing or should wait longer.

thanks in advance

if read intentservice you'll see that

onstartcommand(intent intent, int flags, int startid)
should not override method intentservice.

instead

the intentservice class exists simplify pattern , take care of mechanics. to use it, extend intentservice , implement onhandleintent(intent).


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -