1

I have an application on Google Play. And now I want to integrate push-notification library in my application. So I initialize this and register user in my class extended Application.class. Some people update application on Google Play automatically and not open this. And registration on push-services will be only when user launch application. So I want that my class with init library and register user in push-service will be run when application updated from Google Play. Is it possible?

user3499878
  • 1,023
  • 2
  • 10
  • 15

1 Answers1

1

Use a BroadcastReceiver with this action: android.intent.action.PACKAGE_REPLACED (How to know my Android application has been upgraded in order to reset an alarm?).

You can register a user once onReceive is called. It will be triggered even if the app is closed because the receiver is registered in AndroidManifest.xml. Just make sure it's not triggered while updating other apps.

Community
  • 1
  • 1
Gennadii Saprykin
  • 4,505
  • 8
  • 31
  • 41