I'm stumped by the non-action of the expansion file download function of the Google licensing plugin. After calling checkExpansion() the event listener for Event.DOWNLOAD_REQUIRED is triggered, which seems to correctly recognize that the Google has an expansion file for the app with the given key, and that it is not present on the device. My understanding was that the download would begin in that case, and I assumed there would be events handled by the DOWNLOAD_STATE and DOWNLOAD_PROGRESS listener. None of those event listeners are being triggered, and I see no events at all after DOWNLOAD_REQUIRED.
I'm testing on an Android device, with a Gideros player app built with the in-app billing and Google licensing plug ins, and that app is in debug mode in Eclipse. The LogCat shows nothing from the time the player is up and running. I'm not seeing anything showing up in sdcard/Android/obb where I would expect the expansion file to be downloaded on the device.
Anyone have any ideas what I'm missing?
PaulH
Comments
Yes the plugin should also manage downloading of the expansion files with the events you stated.
Why it does not work for you, can be multiple reasons.
Firstly are you connected to Internet.
If yes, are you connected through WiFi? Because by default it won't download through cellular networks.
Also with release version you sign the apk with your certificate, and I think licensing and probably also expansion was somehow bind to certificate, so it is possible that it won't run as expected on debug version through eclipse.
I think @zoolax (from this thread: http://giderosmobile.com/forum/discussion/comment/36040#Comment_36040) was the last one playing with expansion files, maybe he knows something more on that
Yes, the device is connected via WiFi (it's a wifi only tablet.) I've also tried enabling cellular downloads in the app just in case there was a bug in code related to when downloads would be allowed.
The behavior I'm seeing is the same in a signed app as in Eclipse. I've uploaded the app to the store as an Alpha test, with code in place to show updates in response to any of the licensing and expansion related events. It shows the first event, that Google replied that an expansion file needs to be downloaded, and no other events.
I've just reinstalled the app on the tablet via the Play Store directly, and on this device the store actually did the download automatically. I see the expansion file on the SD card where it should be. Yet the app still gets the one response from the server, saying a download is needed. It's as though communication from the server is not really happening, but if I add a character to the app's public key I get the invalid key response from the server.
Any other possibilities that come to mind?
PaulH
Stranger still, if I disable Wifi on the device and restart the app, it's still getting the DOWNLOAD_REQUIRED event. Clearly the server wasn't really consulted. Perhaps it's just deciding the download is required as there is no OBB folder. Trying to step through the plugin code in Eclipse...
Paul
Add service android:name=".GiderosAPKDownloader" in application tag
Add receiver android:name=".GiderosDownloadReceiver" in application tag
But if you just copy in the src folder as per the instructions it really needs to be added like this:
service android:name="com.giderosmobile.android.plugins.googlelicensing.GiderosAPKDownloader"
receiver android:name="com.giderosmobile.android.plugins.googlelicensing.GiderosDownloadReceiver"
The other option would be to move those files to the top of the src folder.
Installed as described the service never starts, no no more events are triggered. Now the download actually happens, though the download_complete event doesn't seem to be happening. Oh well - I'm just happy to be making progress again!
PaulH
Yes you are right about the package names, updated the example manifest in the labs and install instructions
About the events then download state should have changed.
Download state should have this possible values:
The download is completing, and my app is getting the STATE_COMPLETED event after all, but strangely that's followed by the states for paused due to network unavailable, paused by request, wifi disabled, need cellular permission, need wifi, roaming, network setup failure, sd card unavailable, unlicensed, fetching URL, sd card full, canceled, and finally settles on state_unknown. It seems this whole list of events fire after the download is completed for some reason, but my code can ignore any state changes once the download is complete.
By the way this all works fine using the custom player on the device and running through the Gideros Studio.
So the download issue is resolved, but now my code doesn't seem to be able to access the contents in the expansion file. Am I correct in understanding that an io.open(file_path, "r") should open the file if it finds it as a resource in the APK itself, or failing that, in the patch expansion file, or failing that, in the main expansion file? So any file opened with the resource path marker ("|R|") or none since that's the default, should work that way?
Paul
But as far as I remember, you don't need to access the downloaded files in any way, thats all done internally, you just simply do the same, as you would do on desktop or in Gideros player
Paul
That gives me a workaround. Rather than moving the folders that contain the bulk of the images and some supporting text and dat files into the expansion file, I can keep the folders, text and dat files in the APK and just pull the images out to the expansion file.
Thanks again for taking time to respond. Enjoy the rest of your vacation!
Paul
also about .jet, it is already changed in exported project so should be working correctly.
Basically how you should create the expansion files is by zipping with store some large files or folders and deleting them from assets folder, more info here:
http://giderosmobile.com/DevCenter/index.php/APK_Expansion_Files
So at first please try testing as described in the link and if that works try uploading it to Google Play and doing download.
file, result = io.open("test.txt", "r")
local nehe = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
message_font = TTFont.new("interstate black.ttf",42, nehe)
if (file ~= nil) then
text = string.format("Opened.")
else
text = string.format("Not opened: %s", result)
end
local tf = TextField.new(message_font, text)
tf:setPosition(600,10)
stage:addChild(tf)
tf:setRotation(90)
If I run on the Windows player, or export an Android project and run via Eclipse on an Android device, it says "opened", meaning it was able to open the text file. That's using the text file from within the APK.
To move the text file to an expansion file, I remove the text file (renamed test.txt.jet during the Gideros export) from (exported project)/assets/assets, and put it in an uncompressed zip file using:
7za a -mx0 main.1.com.mydomain.myapp.obb test.txt.jet
I manually copy that file to (sdcard)/Android/obb/com.mydomain.myapp.
I rebuild the app via Eclipse to get the APK without the text file, and run on the device. It displays "Not opened: No such file or directory". At this point I expected to see the "Opened" message indicating the text file was found in the expansion file.
I get the same effect if I use WinRar to build the uncompressed zip file rather than 7Zip, using "store" as the method and zip as the file type, the renaming the zip file to the obb file name. It seems unlikely the problem is the way the expansion file is built, and I've repeatedly checked that the naming of the package of the APK matches the name of the folder and the package name portion of the obb file.
I've also tried adding the Google Licensing plugin in case some of the code for reading from expansion files is in the plugin with the code that supports downloading expansion files.
What could I be missing?
I've put this Gideros project, the exported Android project with the text file removed, and the expansion file here: http://www.pishtech.com/expansion_file_test.zip
Any further help would be greatly appreciated! This is pretty much the only roadblock preventing the release of my new product.
Paul