0

I use

ActivityRecognition.ActivityRecognitionApi.requestActivityUpdates(googleApiClient, interval, getPendingIntent());

to track the user's activity, which works fine. But when I install an update by creating a new build with Android Studio, I stop getting activity updates until I call requestActivityUpdates() again. The same happens when I build a release build and update it with a newer release build.

I would like to continue getting activity updates after the user updates my app in future releases, how can I fix this?

mennovogel
  • 339
  • 1
  • 2
  • 9

1 Answers1

2

You could use a broadcastreceiver that listens for the ACTION_PACKAGE_REPLACED intent.

Copy-pasted from the description:
Broadcast Action: A new version of an application package has been installed, replacing an existing version that was previously installed.

Then simply set up the updates again when this intent is received.

Moonbloom
  • 7,738
  • 3
  • 26
  • 38