I have an intenservice that is automatically started by the user and my application. I need to be able to kill all pending intentions that are executed when the user exits my application, but I cannot get it to work. I tried stopService () and stopself (), but intentions continue to disable intentservice after the user logs out. I would try to get the intent identifier, but this is difficult, since every time an intentservice is started, the variable containing the id of the target is empty. Here is my intenservice code:
public class MainUploadIntentService extends IntentService { private final String TAG = "MAINUPLOADINTSER"; private GMLHandsetApplication app = null; private SimpleDateFormat sdf = null; public boolean recStops = true; public MainUploadIntentService() { super("Main Upload Intent Service"); GMLHandsetApplication.writeToLogs(TAG, "GMLMainUploadIntentService Constructor"); } @Override protected void onHandleIntent(Intent intent) { GMLHandsetApplication.writeToLogs(TAG, "onHandleIntent Started"); if (app == null) { app = (GMLHandsetApplication) getApplication(); } uploadData(app); GMLHandsetApplication.writeToLogs(TAG, "onHandleIntent Finished"); } @Override public void onDestroy() { GMLHandsetApplication.writeToLogs(TAG, "onDestroy Started"); app = null; stopSelf(); GMLHandsetApplication.writeToLogs(TAG, "onDestroy completed"); } public void uploadData(GMLHandsetApplication appl) {
source share