0

I have an app installed which is not running in foreground, but has a BroadcastReceiver which will be receiving events. Now I am updating the app from Google Play.

After the update is installed, will the app work with the new updates(Let's say I have updated some code in my BroadcastReceiver) without opening it?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Joshua
  • 1,167
  • 1
  • 14
  • 32

1 Answers1

1

Your app just replaced (by PackageManager) by a new version. Of course your BroadcastReceiver is updated. Actually, if you have some doubts, just download on this phone something like Show Java and select your app. So you will decompile your app, and check that receiver is updated as you suppose

HeyAlex
  • 1,666
  • 1
  • 13
  • 31
  • You are telling about checking for the updated code. But I want to know whether the `BroadcastReceiver` will be running with the updated code or will it stop receiving events? – Joshua Feb 28 '18 at 10:33
  • it will stop receiving on the moment while it gonna be replaced, so after package replaced it will normally continue getting all events (cuz system will be already know about your receiver) – HeyAlex Feb 28 '18 at 10:34
  • You sure about it? Because, when I tested it, some devices are automatically running with update as you said, and some are not running. – Joshua Feb 28 '18 at 10:39
  • I'm sure about that (of course if it non chinese devices which can potentially make some kind of changes in their android). what kind of events u're trying to listen? Maybe it's api specific events? – HeyAlex Feb 28 '18 at 10:40
  • Main event is Location updates using Google APIs and some other events like Connectivity, Battery, etc. I checked for Location updates – Joshua Feb 28 '18 at 10:43
  • your events are under restrictions in Android Oreo as i know. Check here https://developer.android.com/about/versions/oreo/android-8.0-changes.html .So it can be a problem for you. On Android the only way is to register BroadcastReceiver dynamically (so you need a service and receiver that will be triggered by events) – HeyAlex Feb 28 '18 at 10:46
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/165957/discussion-between-andrew-browiski-and-joshua). – HeyAlex Feb 28 '18 at 10:47