android - background services for getting activity recognition -


i read lot services tried lot of examples unfortunately couldn't understand how keep services running activity recognition api , running.

in cases android os killing somehow running service.

what tried:

i put start_sticky when killed never runs again

@override public int onstartcommand(intent intent, final int flags, int startid) {      // code here     return start_sticky; } 


started service again when detected service killed. not worked expected. sending broadcast , starting service again.

@override public void ondestroy() {     sendbroadcast(new intent("youwillneverkillme"));     super.ondestroy(); } 


know foreground services in case there no way can use foreground services. have forget solution.

is there other way can suggest me solution? doing there facebook or viber getting messages?


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -