cordova-plugin-xapkreader icon indicating copy to clipboard operation
cordova-plugin-xapkreader copied to clipboard

OBB file on extSD

Open BobAchgill opened this issue 8 years ago • 69 comments

Not sure if this is an issue but I don't seem to be able to manually test my OBB file when it is on the external SD. Works OK when on the internal SD. Should it work on the External SD using these or other settings? I would like to target the extSD ... just because there is more space there!

I am using ... Command line :

  cordova platform add [email protected]

config.xml :

<preference name="android-maxSdkVersion" value="24" />
<preference name="android-installLocation" value="preferExternal" />

BobAchgill avatar Apr 17 '18 05:04 BobAchgill

Not sure. It should work theoretically. Is that the settings for Cordova 6.5? Try it on that version first...

agamemnus avatar Apr 17 '18 05:04 agamemnus

I am using Cordova 6.5.0

Surely someone has experience using the xapkreader plugin and stores the obb files on the extSD.

I tried looking in stack overflow with this search... Cordova expansion file extsd

... but no hits.

BobAchgill avatar Apr 17 '18 23:04 BobAchgill

Yeah I think someone else wrote about this in the issues pages? It just gets really complex. I completely forgot all the details.

agamemnus avatar Apr 17 '18 23:04 agamemnus

Does xapkreader do anything in the code to support accessing the OBB file if the it is not located on the internal SD but instead located on the extSD? Or does Android OS just handle switching the path so that the app is agnostic as to on which storage the the OBB is stored?

BobAchgill avatar Apr 17 '18 23:04 BobAchgill

There is indeed code there to figure out the path...

agamemnus avatar Apr 17 '18 23:04 agamemnus

... but is there the switch code between internal and extSD?

Who originally wrote the xapkreader plugin? Are they still around?

BobAchgill avatar Apr 18 '18 00:04 BobAchgill

Intel. But then I reworked it.

https://github.com/agamemnus/cordova-plugin-xapkreader/blob/cordova-6.5.0/src/android/XAPKExpansionSupport.java

That file has the code for figuring out the path...

agamemnus avatar Apr 18 '18 00:04 agamemnus

OK thanks! I will try to see if this solves the problem of making the cordova app with OBB file movable to the SD card.... https://ourcodeworld.com/articles/read/171/how-to-enable-the-move-to-sd-card-feature-in-a-cordova-app-for-android

BobAchgill avatar Apr 18 '18 06:04 BobAchgill

The link above had me add the cordova-custom-config plugin which made sure the android:installLocation="preferExternal" is automatically taken from the Config.xml and "properly" added to the manifest so the app can be movable by the user to and from the External/Internal storage.

So now when i look at the app's storage settings [on my S7] I get the option to move the app to the external storage. It dutifully runs a gas gage showing that the app (and data?) are being moved to the external storage. When complete the app storage location indicator changes from Internal to External.

I looked at the external storage with a file manager and no folder was made for the app data being moved to external. When I run the app it [runs!] but appears to still be using the internal obb file. I know this because when I rename the internal obb app folder the links to the obb file no longer work.

Any ideas why the obb folder/file would not have been copied over?

When I try manually copying the obb folder/file over to the correct location on the external SD the app does not try to read it there.

I thought maybe it is a permissions thing... but the manifest shows this line... <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Is there a forum where would be best to ask for help on this?

BobAchgill avatar Apr 19 '18 05:04 BobAchgill

Android Central, perhaps.

On Thu, Apr 19, 2018, 1:05 AM BobAchgill [email protected] wrote:

The link above had me add the cordova-custom-config plugin which made sure the android:installLocation="preferExternal" is automatically taken from the Config.xml and "properly" added to the manifest so the app can be movable by the user to and from the External/Internal storage.

So now when i look at the app's storage settings [on my S7] I get the option to move the app to the external storage. It dutifully runs a gas gage showing that the app (and data?) are being moved to the external storage. When complete the app storage location indicator changes from Internal to External.

I looked at the external storage with a file manager and no folder was made for the app data being moved to external. When I run the app it [runs!] but appears to still be using the internal obb file. I know this because when I rename the internal obb app folder the links to the obb file no longer work.

Any ideas why the obb folder/file would not have been copied over?

When I try manually copying the obb folder/file over to the correct location on the external SD the app does not try to read it there.

I thought maybe it is a permissions thing... but the manifest shows this line...

Is there a forum where would be best to ask for help on this?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/agamemnus/cordova-plugin-xapkreader/issues/122#issuecomment-382611555, or mute the thread https://github.com/notifications/unsubscribe-auth/ADFJWPiy7jm5VGodUZlPJDVFT5RMOAHmks5tqBsygaJpZM4TXp_3 .

agamemnus avatar Apr 19 '18 08:04 agamemnus

I posted this to Android Central... https://forums.androidcentral.com/android-apps/883693-expansion-file-not-moved-extsd.html#post6226447

Expansion file not moved to extSD

When I try to use the app storage setting menu on my S7 to move my app made with Cordova from internal to external storage the OBB expansion file does not move over though the app storage settings indicator does change from internal to external.

BobAchgill avatar Apr 20 '18 20:04 BobAchgill

I just don't know the appropriate settings here, and it changes all the time to boot...

agamemnus avatar Apr 20 '18 20:04 agamemnus

Also posted the question on the Android Forums... https://androidforums.com/threads/cordova-obb-expansion-file-not-moved-to-external-storage.1264878/

BobAchgill avatar Apr 20 '18 21:04 BobAchgill

Looks like, from Android5.0 onwards, cordova-plugin-xapkreader plugin would need to be upgraded to support using the serial number of the extSD in the path in order to support moving the app and OBB to the extSD...

From Android 5.0 onwards, the location of the external (removable) SD is no longer a fixed path. Instead, the serial number of the SD card is used in the path. For example, on my Samsung Galaxy S4 which is running Android 7.1.1, the physical external removable SD card path is /storage/4975-1401/.

... or is there a way to hack so that cordova-diagnostic-plugin can be used to make cordova-plugin-xapkreader redirect to the correct place to both move/write and read the externally stored OBB?

BobAchgill avatar Apr 24 '18 16:04 BobAchgill

I posted this feature request to cordova-diagnostic-plugin for some how it to help cordova-plugin-apkreader in storing app and OBB expansion files on external storage. https://github.com/dpa99c/cordova-diagnostic-plugin/issues/299

BobAchgill avatar Apr 24 '18 17:04 BobAchgill

Dave Alden with cordova-diagnostic-plugin says:

getExternalSdCardDetails() will provide the filepath(s) to external removable storage locations.

These filepaths can be used along with cordova-plugin-file to read/write files to this location. Or you could enhance cordova-plugin-xapkreader to do this.

getExternalSdCardDetails() is a function in his cordova-diagnostic-plugin.

@agamemnus are you able to add external (removable) storage support to cordova-plugin-xapkreader so that apps (Android 5 and beyond) can have their install moved to extSD ?

BobAchgill avatar Apr 24 '18 20:04 BobAchgill

Maybe you can try updating the code and then submit a PR? I am very busy... if not, maybe the weekend.

agamemnus avatar Apr 24 '18 20:04 agamemnus

I'm not a developer. :(

Most of my users in developing countries will not have enough internal free space to install the free 1.5GB literacy app. Hence, my quest to get the support for ...

<preference name="android-installLocation" value="preferExternal" />

to work.

One other random thought... Can I just compile using something less than android@5 and skirt the issue that way? Or does this issue result because the device's Android level is beyond 5?

BobAchgill avatar Apr 24 '18 21:04 BobAchgill

The latter, I am pretty sure.

agamemnus avatar Apr 24 '18 21:04 agamemnus

Your donor gittip link does not work in your readme.

BobAchgill avatar Apr 25 '18 01:04 BobAchgill

Ha. Yeah they shut the system down. How about I will update that when I also update the file system code?

On Tue, Apr 24, 2018, 9:36 PM BobAchgill [email protected] wrote:

Your donor gittip link does not work in your readme.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/agamemnus/cordova-plugin-xapkreader/issues/122#issuecomment-384133408, or mute the thread https://github.com/notifications/unsubscribe-auth/ADFJWNuyslTrdPdzqA2CHlGxB_HRb0eyks5tr9MggaJpZM4TXp_3 .

agamemnus avatar Apr 25 '18 01:04 agamemnus

Yeah same problem here. Pls give a solution for how to move obb on SD.

var18k avatar Apr 30 '18 11:04 var18k

@agamemnus any chance you can implement this fix soon?

BobAchgill avatar May 03 '18 04:05 BobAchgill

getExternalSdCardDetails is a function on cordova-diagnostic-plugin... so I would have to copy their code.... not an MIT license..... bit of a headache...... might have to do my own.

Maybe this weekend, sorry.

agamemnus avatar May 03 '18 05:05 agamemnus

Any progress over the weekend?

BobAchgill avatar May 07 '18 13:05 BobAchgill

I am on a deadline for a thing, so no progress.

agamemnus avatar May 07 '18 14:05 agamemnus

Maybe this weekend?

BobAchgill avatar May 11 '18 17:05 BobAchgill

Maybe.

On Fri, May 11, 2018 at 1:28 PM, BobAchgill [email protected] wrote:

Maybe this weekend?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/agamemnus/cordova-plugin-xapkreader/issues/122#issuecomment-388431059, or mute the thread https://github.com/notifications/unsubscribe-auth/ADFJWFLYA7C9kfk60j0wRyitRjL9GEYRks5txcpEgaJpZM4TXp_3 .

agamemnus avatar May 11 '18 17:05 agamemnus

Maybe this week?

BobAchgill avatar May 29 '18 06:05 BobAchgill

Maybe...

On Tue, May 29, 2018, 2:14 AM BobAchgill [email protected] wrote:

Maybe this week?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/agamemnus/cordova-plugin-xapkreader/issues/122#issuecomment-392663735, or mute the thread https://github.com/notifications/unsubscribe-auth/ADFJWFBP9Pfa6y-BzEP-SNC-UJzrrzP8ks5t3OdEgaJpZM4TXp_3 .

agamemnus avatar May 29 '18 13:05 agamemnus