MyService:
public class MyService extends Service{
public void onStartCommand(...){
//....
return START_STICKY;
}
}
MainActivity:
public class MainActivity extends Activity{
public void onCreate(Bundle b){
Intent i = new Intent(this, MyService.class);
startService(intent);
}
}
I have created a service as coded above. It is working proper in most of the devices. But when I tested in asus zenfone 2, if the user close the application, the service also stops. I have googled for this issue, and din't find similar device specific issue. What could be the reason for behaving like this in particular device ? And how do I resolve this,thanks!
Got resolved the issue, the problem was not with the Service or Coding, there is an application pre-installed in asus zefone called auto-start manager, that disables the service when app goes in background, so user has to enable background running facility for the specific application.