cordova-android icon indicating copy to clipboard operation
cordova-android copied to clipboard

Change Absolute Assets Path to Internal Storage Android

Open jufryananta opened this issue 5 years ago • 7 comments

Issue Type

  • [ ] Bug Report
  • [x] Feature Request
  • [x] Support Question

Description

Before this, sorry for my english.

I have a game project was made by a game engine. Then, port it to android with cordova. Because the size of apk/aab more than 150MB, I try to implement AssetPackManager from Play Core API android studio for bundle build. When publish and try to install from playstore, the application download assetPack, but the assets were installed to root application (/data/user/0/..). So, I cant use it with default absolute path (file:///android_asset/www). I tried search the solution from any website, but nothing result. I dont know, May I miss something or maybe this problem must be made a plugin or whatever.

My Question or Request is: May I to change default Absolute asset path (file:///android_asset/www) to directory where asset was installed? ex: "/data/user/0//files/file.ext"

Thanks

Information

Make a project with cordova-android, implement with some dynamic asset delivery. When publish and user install your application, the application will download and install assetPack and we cant use that installed assets as normal assets with absolute path. (its ok with relative path)

Command or Code

I think baseURL, basePath?

Environment, Platform, Device

Cordova and Android Studio Canary latest version

Version information

Cordova: [email protected] OS: Windows, App: Android Studio Canary

Checklist

  • [x] I searched for already existing GitHub issues about this
  • [x] I updated all Cordova tooling to their most recent version
  • [x] I included all the necessary information above

jufryananta avatar Apr 29 '20 11:04 jufryananta

I'm also looking forward for a resolution to this issue

MuhAssar avatar May 10 '20 19:05 MuhAssar

@jufryananta is this resolved, if yes can you pls explain the fix here?

darisettysuneel avatar Aug 08 '20 12:08 darisettysuneel

I would also like this to be resolved.

fjellandermedia avatar Oct 22 '20 14:10 fjellandermedia

I am also trying to impliment play asset delivery with no joy

peasn avatar Mar 22 '21 14:03 peasn

Please this is crucial for large games and apps.

MuriloBeraldo avatar May 05 '21 17:05 MuriloBeraldo

I believe this PR (https://github.com/apache/cordova-android/commit/5e7be8e1d6f9863f78a3bd481a3d366cc4d0a804) has something to do with this issue.

MuhAssar avatar May 05 '21 22:05 MuhAssar

android_assets filepath is a special path that leads to your apps assets directory (which cordova copies the www folder into). This directory is already on android's internal storage. I don't think this can be changed, nor does it make sense to change this (otherwise you wouldn't be able to load your app).

If your extension pack is located at /data/user/0//files/file.ext" (assuming the application ID was omitted here), then this is also within your app's internal storage container and you should be able to access it without any special permissions via the file plugin.

breautek avatar Sep 13 '21 01:09 breautek