apache / cordova-android

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

I haven't found a static file that can be remotely updated without downloading an app. #1625

Closed qingshuiling closed 11 months ago

qingshuiling commented 11 months ago

I need users to not download again, open the app to obtain the latest static file updates, and implement the update app method. Is there any method support?

breautek commented 11 months ago

The app install is a read-only directly. The only process that has access to write to it are privileged apps with root access. These apps are usually preinstalled on your device and is part of the shipped Android OS by the phone manufacturer, like the Google Play app for example. This means you can only update the app core via the existing update mechanisms.

For Google Play, that means uploading a new android bundle (aab file) to the Google Play store.

Because Cordova primarily runs in a webview environment, it is possible to download web assets and store them locally in your app's data container and run them, however, this may be against the app store policies. Each app store may have different policies, but Google Play states an app must not update itself using any method other than Google Play's update mechanism. It does state an exception on code that runs in a virtual environment (like JavaScript) where it provides indirect access to Android APIs, however Cordova provide a native bridge for JS to call on native code outside of standard webview features. Therefore this is a gray area.

For this reason, Cordova doesn't provide any such feature out of the box. An update feature could be implemented at the app level at your own risk.