Is there a way to emulate a Android OS upgrade scenario on AVD emulator?
Asked Answered
S

2

46

I've been trying to simulate a scenario where I want to check how my Android app behaves after an OS update. But I don't have access to physical device at the moment where I can run an actual OS update scenario, so I have to resort to trying it out on android emulator (AVD).

Is there a way I can update the OS on AVD as if it were a real phone, and be able to see how my app would behave?


What I essentially want to test out is this:

Let's say that I have android with API level 21 installed on a device. I install an app with maxSdkVersion 21 on it. Now my device upgrades to API level 22. What will happen to my app?

  • Will the OS silently get my app uninstalled and keep it that way?
  • Will the OS check with play store to see if a build of my app with a supported SDK level is available and download and install that instead?
  • Will the OS at least give me a visual warning or prompt that this particular app is not compatible on the device anymore and tell me what I could do next?

The Android Developer Docs recommends that using maxSdkVersion is not a good idea since in some cases uninstalls would happen.

An application declaring maxSdkVersion="5" in its manifest is published on Google Play. A user whose device is running Android 1.6 (API Level 4) downloads and installs the app. After a few weeks, the user receives an over-the-air system update to Android 2.0 (API Level 5). After the update is installed, the system checks the application's maxSdkVersion and successfully re-validates it. The application functions normally. However, some time later, the device receives another system update, this time to Android 2.0.1 (API Level 6). After the update, the system can no longer re-validate the application because the system's own API Level (6) is now higher than the maximum supported by the application (5). The system prevents the application from being visible to the user, in effect removing it from the device.

Warning: Declaring this attribute is not recommended. First, there is no need to set the attribute as means of blocking deployment of your application onto new versions of the Android platform as they are released. By design, new versions of the platform are fully backward-compatible. Your application should work properly on new versions, provided it uses only standard APIs and follows development best practices. Second, note that in some cases, declaring the attribute can result in your application being removed from users' devices after a system update to a higher API Level. Most devices on which your application is likely to be installed will receive periodic system updates over the air, so you should consider their effect on your application before setting this attribute.

What I also want to figure out is what happens next. And what does "in some cases" essentially mean?

Stupor answered 20/10, 2017 at 10:52 Comment(2)
Did you find an answer for this? I need to simulate an Android upgrade and haven't had any luck.Enervate
@JorgeCevallos see my answer bellowOdawa
U
1

As far as I'm aware, the Android emulator doesn't natively enable simulating OS upgrades. This is so because unlike a physical device, which can download and install system upgrades, an Android emulator is made to emulate a specific Android OS version only.

Priyanka's answer explains the various scenarios well. The app will get uninstalled without any warning. If the app was installed from Play Store then, after the update, the OS will likely try to update to a newer version of the automatically (if available). This is what we usually see on real devices after an OS update, as it installs various app updates post OS update.

Undone answered 26/5, 2023 at 16:33 Comment(0)
O
0

I have created 2 demo apps to check your questions using the emulator. I have updated emulator's API level and restart it because every device gets restart after the system update. Please see this video what happening :)

Will the OS silently get my app uninstalled and keep it that way?

yes app get uninstlled

Will the OS at least give me a visual warning or prompt that this particular app is not compatible on the device anymore and tell me what I could do next?

app getting uninstalled without any message or warning

Will the OS check with play store to see if a build of my app with a supported SDK level is available and download and install that instead?

I think this can be check if the app is available on the play store. So I'm unable to test this. If anyone knows the answer to this question, please comment

Odawa answered 28/12, 2020 at 11:47 Comment(1)
When i did your steps my app was also gone, but i don't have "maxSdkVersionSet"Zeiler

© 2022 - 2024 — McMap. All rights reserved.