0

I have seen this issue and i don't have any idea why it's happening. When i stop application from ddms under device tab it doesn't stop it appears again even thought i saw it gets closed on the device but it shows again and i have to stop it again and again then its don't appear again.

enter image description here So what's the problem there is there are multiple instance of application run there or it start again when i stop it?

Note: i am using an intent service which runs under while(true) loop (I am thinking may b that's why that behavior happens)

Cœur
  • 37,241
  • 25
  • 195
  • 267
umerk44
  • 2,797
  • 4
  • 23
  • 43

1 Answers1

0

Why are you using a while(true) in your Service? That is the problem.

You should start your service with alarm manager and set the repeat time.

However if you kill the applicaion is not sufficient to stop the alarm, to stop this process there are two alternatives.

1) uninstall the app

2) use service.cancel(pending);

    AlarmManager service = (AlarmManager)c.getSystemService(Activity.ALARM_SERVICE);
    Intent intent = new Intent(yourpackage);
    PendingIntent pending = PendingIntent.getBroadcast(
                    context, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
    service.cancel(pending);
Alessandro Verona
  • 1,157
  • 9
  • 23