PendingIntents and Google Play Services - How to do a cleanup

I played with recognizing the activity of the user and the Fused provider and noticed that even after I deleted the sample application, activity recognition requests / location requests are still running, as I see the following every couple of seconds:

05-20 23:20:22.569: W/ActivityManager(389): Unable to start service Intent { cmp=com.example.android.activityrecognition/.ActivityRecognitionIntentService (has extras) } U=0: not found 

The exception is obviously due to the fact that my service is gone (the application has been deleted).

I see the same with the location provider.

As a result, if the intended intent was used like this

 Intent intent = new Intent(Constants.INTENT_ACTION_LOCATION_UPDATED); PendingIntent pendingIntent = PendingIntent.getService(BasicMapActivity.this, LOCATION_INTENT_CODE, intent, 0); LocationRequest locationRequest = LocationRequest.create().setInterval(5000).setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY); locationClient.requestLocationUpdates(locationRequest, pendingIntent); 

This may leave the GPS survey for the location all the time in case the application was deleted or the application crashed and there was no proper β€œuser cleanup”.

Is this normal behavior? I would suggest that some cleanup in PendingIntents will be done when the application is uninstalled.

Is this because the requests flow through the Google Play Services process?

How can we handle this?

EDIT : A problem has been added to the Android tracker , but it has been said that this is the wrong place to report problems with Google Apps. Submitted to Google Mobile Help Forum

+4
source share

Source: https://habr.com/ru/post/1481844/


All Articles