Apk external data, Android Expansion

2020-03-07 07:06发布

问题:

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

回答1:

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.

  1. Perform a request using Google Play's Application Licensing to get your app's expansion file names, sizes, and URLs.
  2. 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.