Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 393
abhishekcghosh Avatar asked Oct 20 '17 10:10

abhishekcghosh


People also ask

How can I change my Android Emulator version?

Launch the emulator, tap "..." on the right-hand side panel, click Help > About. Go to Android Studio > Preferences, search for "Android SDK", click "SDK Tools", and then scroll to Android Emulator. On Mac, go to Terminal and run ~/Library/Android/sdk/emulator/emulator -version.

Why are Android emulators so slow?

The Android Emulator is very slow. The main reason is because it is emulating the ARM CPU & GPU, unlike the iOS Simulator, which runs x86 code instead of the ARM code that runs on the actual hardware.

Can Android Studio be used as emulator?

The Android Emulator enables you to test your app on many different devices, virtually. The emulator comes with Android Studio by default, so you shouldn't have to manually install it. The basic workflow with the emulator goes as follows: Verify that you have the system requirements.


1 Answers

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

like image 178
Priyanka Avatar answered Nov 08 '22 23:11

Priyanka