Google-Play-Expansion-File
Google-Play-Expansion-File copied to clipboard
Downloading APK Expansion file twice
My apologies for leaving a rather vague bug report. :)
I've been using version 1.3.4 of the library, in this project: https://github.com/agwells/cordova-plugin-xapkreader/tree/cordova-6.3 . (Actually a Cordova plugin, which gets used with a Cordova app.)
It worked fine in testing, but when we deployed it to more devices, some users downloaded the expansion file twice. I haven't been able to replicate this myself, or directly inspect an affected device, but it seems that the expansion file was downloaded by Google Play during app installation, and then downloaded again by my app.
The affected devices all seem to have been Android 6 or 7, and may have included a Samsung Galaxy Note4 and Samsung Galaxy S5. (Although I have a confirmed report that it worked fine on a Samsung Galaxy S6 with Android 6.)
Ah, I see it seems to be a workaround (commit 93a03bd34acad67) to this issue: https://code.google.com/p/android/issues/detail?id=197287
In my case it's a problem, because I'm using a 350MB expansion file.
It sounds like the possible workarounds are:
- Add android.permission.WRITE_EXTERNAL_STORAGE to the app
- OR, do nothing and the user will be prompted for the permission when the app tries to access or download the file.
Is that correct?
@agwells Yes, obb can be downloaded twice on api 23 and higher due to this problem.
-
android.permission.WRITE_EXTERNAL_STORAGE
doesn't help because on >=api 23 you have to request this permission at runtime. - It is correct. You can request permission and only after receiving it start downloading obb. But sometime it is hard to explain users why it needed because expansion file is something related to internal machinery. That is why I prefer download obb again without requesting. For my not huge obbs (<50mb) it works fine.
I can see now why you did this. But I was kind of blindsided by this behavior because I'd thought, from the README, that this project was an unchanged copy of Google's code that had just been published to a repo to make it easier to add it as a Gradle dependency.
So, I'd recommend disabling this behavior by default (if that's possible) or at least mention in the README that the library contains custom code.
@agwells Agree with you.