I am not sure,
But I think the service option that you have chosen is not the best option (Intent service), which is oriented to short tasks and besides if I am wrong the service stops when the app is destroyed.
see:
Service vs IntentService
https://developer.android.com/guide/components/services.html
In your case, you need a service could be bindable using IPC (Inter Process Communication). or RPC calls.
In my opinion, you need a basic service:
public class BasicService extends Service {
public BasicService() {
}
@Override
public IBinder onBind(Intent intent) {
throw new UnsupportedOperationException("Not yet implemented");
}
@Override
public void onCreate() {
Toast.makeText(this, "My service is created", Toast.LENGTH_LONG).show();
}
@Override
public void onStart(Intent intent, int startId) {
// For time consuming an long tasks you can launch a new thread here...
Toast.makeText(this, " Starting service", Toast.LENGTH_LONG).show();
}
@Override
public void onDestroy() {
Toast.makeText(this, "Service Destroyed", Toast.LENGTH_LONG).show();
}
}
One last thing, you will need to stop manually using, because you want not to make stopSelf() function.
stopService(new Intent(this, BasicService.class));
Finally if you want to start a service:
startService(new Intent(this, BasicService.class));
Hope this helps.
Cheers.
Unai.