nilkash
nilkash

Reputation: 7536

Android activity recognition not working properly

Hi I am developing android application and in that I am using activity recognition. I download Google's sample application for activity recognition. It working properly without any error. But my main problem is in following sequence :

I install that application and I start activity recognition. Without stopping that service I uninstall hat application. again I install same application. My Application start listening for activity recognition without my asking me.

So I want to know how it actually works. Why it is continue that service after uninstalling my application. Next time it start listening for activity results.

Am i missing something. Or doing something wrong ?

Need Help thank you.

Upvotes: 2

Views: 2035

Answers (2)

enshrentko
enshrentko

Reputation: 29

you should also cancel the pendingIntent, using pendingIntent.cancel()

Upvotes: 1

metalmonkeysoftware
metalmonkeysoftware

Reputation: 636

It sound like you aren't stopping listening for the recognition intents.

To stop listening for these you need to make sure you are calling:

yourActivityRecognitionClient.removeActivityUpdates(youtActivityRecognitionIntent);

Put the above in the onDestroy() function and it should stop listening for intents on stopping the service.

Upvotes: 1

Related Questions