I'm trying to understand if it is possible to split an Android App into two parts (installed from one APK). I looking into this to install one part on the Device memory and the other part on the SD-CARD. The two parts belong together and should not be installed separately.
Note: I need to separate not only resources, but also activities, so APK Expansion Files
not a solution, because not provide such functionality.
I think it will be possible. Can you try following approach?
android:installLocation="preferExternal"
and then launch your desired activity of second appI've not tried this yet but theoretically seems legit.
Let me know if this works. Thanks!
APK Expansion Files
Google Play currently requires that your APK file be no more than 100MB. For most applications, this is plenty of space for all the application's code and assets. However, some apps need more space for high-fidelity graphics, media files, or other large assets. Previously, if your app exceeded 100MB, you had to host and download the additional resources yourself when the user opens the app. Hosting and serving the extra files can be costly, and the user experience is often less than ideal. To make this process easier for you and more pleasant for users, Google Play allows you to attach two large expansion files that supplement your APK.
Google Play hosts the expansion files for your application and serves them to the device at no cost to you. The expansion files are saved to the device's shared storage location (the SD card or USB-mountable partition; also known as the "external" storage) where your app can access them. On most devices, Google Play downloads the expansion file(s) at the same time it downloads the APK, so your application has everything it needs when the user opens it for the first time. In some cases, however, your application must download the files from Google Play when your application starts.
Downloading the Expansion Files
In most cases, Google Play downloads and saves your expansion files to the device at the same time it installs or updates the APK. This way, the expansion files are available when your application launches for the first time. However, in some cases your app must download the expansion files itself by requesting them from a URL provided to you in a response from Google Play's Application Licensing service.
The basic logic you need to download your expansion files is the following:
When your application starts, look for the expansion files on the shared storage location (in the Android/obb// directory). If the expansion files are there, you're all set and your application can continue. If the expansion files are not there: Perform a request using Google Play's Application Licensing to get your app's expansion file names, sizes, and URLs. Use the URLs provided by Google Play to download the expansion files and save the expansion files. You must save the files to the shared storage location (Android/obb//) and use the exact file name provided by Google Play's response.
Source
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With