Apk external data, Android Expansion - android

I am using concept of Android Expansion which helps us to remove obstacle of 50mb limitation of Apk.
Following all the steps http://developer.android.com/guide/market/expansion-files.html
I understood that you need to follow file format like this [main|patch].<expansion-version>.<package-name>.obb and did the same.
And also Expansion files may be in (ZIP, PDF, MP4, etc.) format.
I uploaded additional expansion files while publishing apk on Google play. At the time of download apk I get all the additional in my Local(Advanced latest Device), But through code I am not able to get the expansable files of my application.
In code looking at the sampleDownloader code I came to know that it requires three parameter (int type, int expansionCode, long fileSize)
here type: main/patch expansionCode: integer value but I am just wondering how to give FileSize in Long(exact)? and second thing its show message like Download failed because the resource could not be found
Any idea?
Update
Done, all steps are shown here

Did you go through Downloading the Expansion Files? It mentions that
If the expansion files are not there with your Application downloaded from Android Market,
You have to perform Application Licensing to get your app's expansion file names, sizes, and URLs.
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.
UPDATE:
No, its not compulsory that Google Licensing only works with paid Application. There is a clear Note: defined in the Docs itself that any application may use licensing service to initiate the download of an APK expansion file. But, in that case your request will be only for expansion files and not for a check whether the user paid for the app or not.

Related

Google PlayStore console 2017 - obb extension file upload

I am using APK with external OBB Extension file.
PlayStore Console UI has changed since I used this feature last.
I can not figure out how to upload the OBB file.
Even the PlayStore help describes the wrong, old way.
https://support.google.com/googleplay/android-developer/answer/2481797?hl=de
Can someone please give me a hint.
Seems to be solved - the small + button was missing in the German UI Version. I changed my language to English and the + button was there. Now in 2018 the + button is also visible in the German UI. Thanx Google
I've been able to chat with Google support about this, and it's indeed kind of hard to miss. This is not like before where you could set the expansion file at APK upload anymore.
To upload an expansion file or use an existing expansion file, you can only do that while uploading the APK, not after you click on Save.
Once you uploaded the APK, on the line where the APK name is, there's a small + icon with the tooltip "Update APK", you have to click on this icon, and there there's the ability to set/upload expansion file.
In this case you have tu use the JOBB tool to encapsulate the resource files, having your .APK then you can go to https://play.google.com/apps/publish/
then Release management > App Releases , you have the option to test your app first MANAGE ALPHA or MANAGE BETA or publish directly to producction MANAGE PRODUCTION, create a Draft Release.
And then Add or change expansion files
You can upload new or add existing expansion files to APKs in a draft release.
Go to your Play Console.
Select your app.
On the left menu, click Release management > App releases.
Next to the release type you want to update, select Manage.
Drop or select your app's APK file.
You'll see a list of APKs that are associated with your release. Next to the relevant version code, select the add icon .
Choose whether you want to upload a new file or attach an existing expansion file.
If the APK hasn't been published yet, you can change or remove an expansion file by selecting another file or No expansion file. You
can't remove expansion files from an existing release.
Select Save.
This is the current documentation for APK Expansion Files
Read the checklist to use Expansion files in your application:
Development checklist
Here's a summary of the tasks you should perform
to use expansion files with your application:
First determine whether your application absolutely requires more than 100MB per installation. Space is precious and you should keep
your total application size as small as possible. If your app uses
more than 100MB in order to provide multiple versions of your graphic
assets for multiple screen densities, consider instead publishing
multiple APKs in which each APK contains only the assets required for
the screens that it targets.
Determine which application resources to separate from your APK and package them in a file to use as the main expansion file. Normally,
you should only use the second patch expansion file when performing
updates to the main expansion file. However, if your resources exceed
the 2GB limit for the main expansion file, you can use the patch file
for the rest of your assets.
Develop your application such that it uses the resources from your expansion files in the device's shared storage location. Remember that
you must not delete, move, or rename the expansion files. If your
application doesn't demand a specific format, we suggest you create
ZIP files for your expansion files, then read them using the APK
Expansion Zip Library.
Add logic to your application's main activity that checks whether the expansion files are on the device upon start-up. If the files are
not on the device, use Google Play's Application Licensing service to
request URLs for the expansion files, then download and save them. To
greatly reduce the amount of code you must write and ensure a good
user experience during the download, we recommend you use the
Downloader Library to implement your download behavior. If you build
your own download service instead of using the library, be aware that
you must not change the name of the expansion files and must save them
to the proper storage location.

About Android Developer Program Policies, Could I download a dex file from another website and load it?

I want to reduce my android apk file size, so I split some function source code and compile those code to a Jar file, it contain a dex file in the jar file. When android app need use those functions, the app download the jar file and load dex file from it.
But I found the Android Developer Program Policies said:
An app downloaded from Google Play may not modify, replace or update
its own APK binary code using any method other than Google Play's
update mechanism
My question is do I do this a violation?
Yes because you're basically updating your APK without the Google Play's update mechanism. If you truly wish to minimize the .apk file size, you can put your resources online and request them through a custom api.
For example: I developed an app which uses Google Earth marker and polygon coordinates, descriptions and other useful information that are stored on my webserver, online in a .kml file. Because I'm constantly updating the file with new markers and polygons, I don't want the user to download the .apk file with a huge filesize each time I update my resources. So that's why I stored my resources online which the user downloads while using my app and that keeps the .apk filesize to less than 3MB which is great for the people who download the app through the play store. Otherwise the filesize would have been 15MB+ with all the images and other resources with that keeps on growing by each minute.
Nonetheless, the user would have to download the resources one way or another but I do like your way of thinking though to keep the size of the .apk file low as possible.

Facebook App Review upload apk file issue

It was never in vain to integrate Facebook into Android Apps but now things seem to be complicated in a way ,may be to get more secure social media.
That's good though .
The Problem what am having is with the Submit Approval Process . i am unable to upload the .apk file in my application as my file size exceeds 100MB. when i upload the .apk file in zip form on dropbox and shared the download link/Url to facebook , it says that MIME/TYPE should be in application/zip.
I have tried following scenarios but no Success:
1) Uploading .apk single file on my dropbox then using its downloadable link.
2) Uploading .zip file containing only .apk file int on my dropbox then using its downloadable link.
3) Uploading .rar file containing only .apk file int on my dropbox then using its downloadable link.
I cannot go for the second option of submitting the app to google play store as my App is Paid App there and Unlike iPhone ,Google does not support for Promo codes but Facebook needs promo-codes for paid app to download it from google play store .
Can you reduce the APK size to <100MB?
Perhaps an other approach is to upload an empty APK, but make it clear in your comments that the real APK can be found on your Dropbox link. State that you are limited by upload size, but that the APK in the Dropbox link should be reviewed.
Did you try this solution to reduce the APK size ? :
In Android studio: Refactor -> Remove Unused Resources.

Android APK size limitation in Google Play

Docs say that APK size limit in Google Play is 50MB, with option for two 2GB expansion APKs.
However, I can find apps in Google Play store that are beyond this 50MB limitation (Gears & Guts for example is 371MB). I can download this game straight from Google Play itself without need for external downloaders. Do they have some extra feature as Top Developer to upload APKs over 50MB, or does Google Play just hide the fact that it's downloading expansion files rather than the APK itself?
Expansion files act kind of weird. To the user, they look like a normal app. A 50MB app with 150MB worth of expansion files will look like a 200MB download. Google Play will download the main app first. It will then download the main expansion file and then the patch expansion file. All in seemingly one lump sum.
However, it is possible for the download to be partial. I.E., the user can finish the main app download without the expansion files. As such, you MUST implement a custom downloader in order to retrieve the remaining files on the event the initial download fails. To make things a bit more complicated, sometimes the expansion files are not included in the initial download. I don't know what causes this, but I've seen it happen on rare occasions.
UPDATE: I just downloaded my APK again and Gears and Guts and they both show as one download but if you look at the status of the download in the status bar, it'll show that it's downloading an additional file.

Is Downloader Library required for Android expansion files?

My app requires a lot of image resources, so I've had to package them into an expansion file. I've got this working fine when I manually copy the expansion file to my emulator's shared storage. What's unclear to me is the whole download process.
In Google's (often frustrating) documentation, it says:
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.
My app will be free with a single expansion file. Can I actually rely on the expansion file being downloaded with the app? Or must I implement the downloader service to ensure that the expansion file is downloaded when the app starts?
What are the circumstances under which the expansion file would not be downloaded with the apk? I suppose that the user might erase or remove the shared storage volume onto which the expansion file was originally copied, so that might be a case I'd have to worry about.
Tell me I can be lazy! Come on! And then someone link to this question on a blog post lamenting the laziness of app developers. OK, OK, I won't get all defensive. I just want to understand the mechanics here, and yes I would rather avoid the extra headaches of implementing the downloader service. I'm not a full-time Android developer, and I've got other things to do!
Thanks
The play store will attempt to download the expansion files but network connections fail or time out etc
You should check the files are available when your app starts and manually download them if they are not.
If you don't allow for this eventuality then some users will be unable to use your app unless it will work without the expansion pack.

Categories

Resources