I am currently working on an android game but when I try to build it, we can do it in two ways i.e.
If we check the Bundle Opting in the build menu then it will come in a single file of formate .adb (Android Debug Bride) it may or may not work with Google Play Store or the App Store but I am not targeting on that I wanted a file or files that I can share with my friends or on itch.io because you can only upload a file or files on it, it is not responsible for installing for anything and whoever downloads the from it, he will just get the file on his/her android device and will not get an installed app to start playing it.
we can also check the Splitting opting in the player menu of project setting and then the build will split into two files, 1. .apk , 2. .obb. well this is a good option but with the same problem if I upload it to a distributor or share it to my friends the two files will be downloaded or shared with no installation
Please tell me a way how I can make a file that can download itself or any solution to this.
I just want a way to build an android game that can easily be installed through a distributor or through sharing
Thank You in Advance
What you want is just an APK.
An app bundle is intended for the Google Play Store. If you upload your app as an app bundle to the Play Store, Google repackages it into multiple APKs which only contain the data and code that is required for specific device configurations of end users. E.g. it only contains specific languages, and code for specific architectures and so on.
If you enable the "Split Application Binary" option, Unity limits the size of your APK to 100MB since this is the limit of the Google Play Store. It then creates the expansion file (.obb) which you would also upload to the Play Store.
In your case, you don't need any of it. You need one APK.
Disable "Build AppBundle (Google Play)" and "Split Application Binary" and you should be able to create one big APK.
Hi i am looking into an android development , as we all know when we build the project it makes an APK that is the whole program. but is it possible to make a an android project / APK that would be able to use external files to include more info into the project.
like say for example i have a list commands or functions in my list , but i dont want it to be added into my APK build , is it possible to use it externally?
i was curious because something like COC and other games after downloading it , then downloads extra data from the net , more into updates for the whole game.
how is this possible or is it possible to do , and use functions or source codes externally and not include it into the APK , and also the proper usage of it
Any Android App can connect to the Internet and save downloaded data files to use as they need, without requiring to include them inside the APK. Indeed, for many games (and other Apps having large data sets), it's a sensible option.
There are a couple of things to be aware of:
Android restricts where (on the filesystem) you can save files. And no matter where you save the files, the user can delete them at any
time. Your App should be able to cope with this.
The files should only ever be data files - not executable code. Attempting to
execute downloaded files is likely to put your users at risk
(depending on the permissions your App was installed with) and is also likely to get your App marked as malware.
You should read the Android documentation on Data Storage to learn a bit more about it.
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?
Create two apps
In the Manifest file of first APK, you should have an Activity that is of MAIN and LAUNCHER category. This way your app will be visible in the Launcher list
You should not have any Activity of MAIN and LAUNCHER category in 2nd APK, but you know which Activity you have to open as Launcher Activity of second app as it's your own app. This way your second app will never show up in Launcher list of apps
Put 2nd APK in assets folder of first APK
Whenever your main app wants to use contents from 2nd app, install 2nd app from assets folder (as mentioned here) with setting the install location on SDCard like this: android:installLocation="preferExternal" and then launch your desired activity of second app
I'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
Your app could just check wether the sd card is currently available ("plugged-in") or not. If it is available your app works like normal and if the sd card is not available the app would automatically quit / show a pop-up / launch different activities / whatever.
Yeah, it's possible. But with a caveat, it would be possible to install both apps separately, since both of them should be uploaded to the store. You just need to use a lot of intents.
You'll need to handle all communications between both apps using intents. That means, everything the first app needs must be asked using an intent to the second app, and failing to find the other app within the device should trigger an intent to the play store. This way, you'll have two apps working like one. Keep in mind, the user is still going to determine where to install your app, but as christian-strempfer pointed, the SD card can be set as the preferred target.
If the purpose of this is saving space, you should make your resources (images, sounds, etc) dynamic. Since all of those are just files inside the apk, you could easily replace them with files from the SD-Card. You just need to upload them somewhere and download them after the app is installed. That way, you could provide the exact versions of each asset and remove them when you need. You could learn which screens are most used and remove the assets for the ones you use less. Etc.
You can, but not for your reason. Multiple APKs are just to ensure your app works for multiple devices - not to divide up its total size between internal memory and SD card.
Multiple APK Support
Although we encourage you to develop and publish a single APK that
supports as many device configurations as possible, doing so is
sometimes not possible. To help you publish your application for as
many devices as possible, Google Play allows you to publish multiple
APKs under the same application listing. Google Play then supplies
each APK to the appropriate devices based on configuration support
you've declared in the manifest file of each APK.
By publishing your application with multiple APKs, you can:
Support different OpenGL texture compression formats with each APK.
Support different screen configurations with each APK.
Support different platform versions with each APK.
Currently, these are the only device characteristics that Google Play
supports for publishing multiple APKs as the same application.
Maybe is this what you want?
APK Expansion Files
If you're just looking for a way to keep application resources on the external drive, Harry's answer will be useful.
Otherwise it's not possible to split one app installation into two parts. You can use the android:installLocation manifest attribute to define where you want to install it and you can even force it to only install internally on the device, but there is no option to split it.
Alternatives
Two Apps
You create two separate two apps and check on start of any of them, if the other one is installed. If not, you ask the user to install the other one and forward the user to the app store.
One app checks the external storage
I don't know your use case, but from your comments it sounds like you're looking for the wrong solution.
The application I'm thinking about has one part that I want always to be available (install on device memory) and one part that the user may make unavailable (temporary) by removing the SD-CARD. Also when the user decides to move the app to or from the SD-CARD, the part that I want installed in device memory should always stay there.
You can just check if the external storage is available and block certain activties if it's not. If you want to make sure, it's the same SD card you can create a UUID on first run and save it both internally and externally. If they match it's the correct SD card.
Conclusion
Your solution probably is too complicated and you should look for alternatives.
You can create two different launching activities from one APK by defining two MAIN LAUNCHER entries in Manifest.xml
<activity android:name=".ChooserActivity"
android:label="Auth Firebase">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".GoogleSignInActivity"
android:label="Auth Google"
android:installLocation="preferExternal">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
this will create two entry points for an app, two different launcher icons one named "Auth Firebase" and other named "Auth Google" both will open different activities.
I'm developing an Android application. I'm very new on Android development.
I see on other projects that textures are hold on res directory. They have to be compiled and deployed into device.
I'm wondering if I can download a picture as a texture from a web service and use it.
I don't know if every media that I need has to be compiled.
Thanks.
Yes you could download the pictures from the web and use them. If you plan on having changeable content then you should probably do so as well.
Adding Images to Res will have them included in the APK and, Then copied to the device on installation (Unless you use zipalign which should sometimes allow you to use content from the apk)
Can I upload content(any type png/jpg) onto android market, which I could download while the application is running.
No, you can only upload Application .apk files on to the Market.
If you don't have much content you can embed it in your application as a Resource. The content is then embedded into the .apk file and you can retrieve it using a standard Android API.
If you have lot of content - say, many megabytes - which you would rather download and perhaps cache on the SD card you'll need your own website.
You can also add it to /res/drawable and use it without the need of downloading.