1

I would like my app to wake up after it has been updated using the market (play store). How can I accomplish that?

By waking up, I mean the Application.onCreate() to be executed.

AlikElzin-kilaka
  • 34,335
  • 35
  • 194
  • 277
  • See similar question: http://stackoverflow.com/questions/2133986/how-to-know-my-android-application-has-been-upgraded-in-order-to-reset-an-alarm – AlikElzin-kilaka Oct 23 '12 at 16:45

2 Answers2

4

As Commonsware mentions, the ACTION_PACKAGE_REPLACED does the trick. You just need to compare your package name with the data for the intent, otherwise you catch all packages being replaced.

In newer API's (12 on up) there is the ACTION_MY_PACKAGE_REPLACED which is only sent to the application that was replaced.

jsmith
  • 4,847
  • 2
  • 32
  • 39
3

In principle, having a manifest-registered receiver for ACTION_PACKAGE_REPLACED should have this effect. Android should have to terminate your process to do the update, causing a fresh process to be created to deliver this broadcast to you.

That being said, I haven't tried this.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491