Greetings, I have an issue and I cannot find an answer everywhere. I just thought someone from this group might have encountered the same problem in the past and can help suggest a good workaround.
I need to restart a service when the application is being updated from Google Play. Some sources said to listen to ACTION_MY_PACKAGE_REPLACED intent broadcast from the system, and we can restart a service from there. I succesfully managed to simulate a update scenario by using ADB command: *adb install -r /path/to/apk* After the command executed, I could verify that ACTION_MY_PACKAGE_REPLACED was being triggered. The problem is, whenever I select " Debug 'app' " (SHIFT + F9) from Android Studio, ACTION_MY_PACKAGE_REPLACED also being triggered, which resulting some unwanted behaviour because of the service restart not in the right scenario. My question is, is there any way we can differentiate package being replaced from Android Studio's " Debug 'app' " command and from manual install from adb? Thanks -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/52af8cbc-938a-4b01-a833-2c92f043dc62%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

