Skip to content Skip to sidebar Skip to footer

Service Stopping In Android

I have Android Service that runs always in background, and another service which is triggered by the always running service which is alarmmanager service. Howewer, I want to stop s

Solution 1:

Stopping the service won't stop the Alarm manager service. You have to stop it manually.

Intentintent=newIntent(this, com.example.deneme.AndroidScheduledService.class);
PendingIntentsender= PendingIntent.getBroadcast(this,
           0, intent, 0);
AlarmManageralarmManager= (AlarmManager) getSystemService(ALARM_SERVICE);

alarmManager.cancel(sender);

To stop a service:

  Intent stopServiceIntent = newIntent(getBaseContext(), yourServiceToStop.class);
  getBaseContext().stopService(stopServiceIntent );

Post a Comment for "Service Stopping In Android"