android - Why does my service calls its onCreate() itself while running? -
i have service in android application stop when quitting application.
public class myservice extends service { public myservice() { } @override public int onstartcommand(intent intent, int flags, int startid) { try { if(intent != null){ //...... } } catch (throwable e) { } return start_sticky; } @override public void ondestroy() { super.ondestroy(); } @override public void oncreate() { super.oncreate(); //...... } @override public ibinder onbind(intent intent) { return null; } }
this service calls oncreate() method while running.when checking state of service running functionalities not work.i stuck on many hours.what problem here?i tried onlowmemory() in service.but not result.
if return start_sticky in onstartcommand()
, service gets created again if killed system (probably on low memory condition). same thing must have happened in case , oncreate()
got called.
Comments
Post a Comment