Я хочу загрузить весь веб-вид из внешнего местоположения. Я хочу, чтобы содержимое папки www присутствовало в каком-то внешнем каталоге Android.
Поэтому я просто добавил папку www в путь к внешней папке /storage/emulated/0/folder/index.html.
Приложение запускает index.html, но в этот момент останавливается.
public class MainActivity extends CordovaActivity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
// enable Cordova apps to be started in the background
Bundle extras = getIntent().getExtras();
if (extras != null && extras.getBoolean("cdvStartInBackground", false)) {
moveTaskToBack(true);
}
// Set by <content src="index.html" /> in config.xml
// updated the launchUrl value
loadUrl(launchUrl);
}
}
файл config.xml (содержит путь URL)
<content src="file:///storage/emulated/0/folder/index.html" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<platform name="android">
<splash density="land-hdpi" src="res/load_final.png" />
<splash density="land-ldpi" src="res/load_final.png" />
<splash density="land-mdpi" src="res/load_final.png" />
<splash density="land-xhdpi" src="res/load_final.png" />
<splash density="port-hdpi" src="res/load_final.png" />
<splash density="port-ldpi" src="res/load_final.png" />
<splash density="port-mdpi" src="res/load_final.png" />
<splash density="port-xhdpi" src="res/load_final.png" />
<allow-intent href="market:*" />
</platform>
index.html file
<html>
<head>
<script>
window.history.pushState('popstateListener', null, window.location.href);
window.addEventListener("popstate", function (e) {
e.preventDefault();
});
</script>
<script src="js/navHandler.js"></script>
<title>My app</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
<script src="cordova.js"></script>
<script src="js/viewIndex.js"></script>
<style>
body {
background-color:black;
}
</style>
</head>
<body style="
background-color: black;
background-image: url('img/load_final.jpg');
height: 100%;
width: 100%;
background-position: center;
background-repeat: no-repeat;
background-size: contain;">
</body>
</html>