Ho notato che Service.START_STICKY
non funziona e quando visualizzo da vicino, ho visto che onCreate() è in esecuzione ma onStartCommand non viene chiamato.Servizio Android onStartCommand mai chiamato
Qualche idea, perché?
@Override
public void onCreate() {
mGlobalData = GlobalData.getInstance();
mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
if (mTimer == null)
mTimer = new Timer();
Log.e(TAG, "onCreate()");
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
int t = START_STICKY;
Log.e(TAG, "call me redundant BABY! onStartCommand service");
// We want this service to continue running until it is explicitly
// stopped, so return sticky.
return t;
}
Ha funzionato per me. Ma quando l'ho rimosso dal metodo onCreate per confermare che questo era effettivamente il problema, il problema era scomparso. – Zeezer