apache / cordova-android

Apache Cordova Android
https://cordova.apache.org/
Apache License 2.0
3.59k stars 1.52k forks source link

Change Absolute Assets Path to Internal Storage Android #964

Closed jufryananta closed 2 months ago

jufryananta commented 4 years ago

Issue Type

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: cordova-lib@9.0.1 OS: Windows, App: Android Studio Canary

Checklist

MuhAssar commented 4 years ago

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

darisettysuneel commented 3 years ago

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

fjellandermedia commented 3 years ago

I would also like this to be resolved.

peasn commented 3 years ago

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

MuriloBeraldo commented 3 years ago

Please this is crucial for large games and apps.

MuhAssar commented 3 years ago

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

breautek commented 2 years ago

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.