美文网首页
Cordova常用操作

Cordova常用操作

作者: bluexiii | 来源:发表于2016-11-22 15:07 被阅读58次

安装

sudo npm install -g cordova
cordova create AppName
cordova platform add browser
cordova run browser
cordova platform add android --save
cordova platform ls
cordova requirements

编译

cordova build android
cordova build android -release
cordova emulate android

配置XML

vi config.xml
<content src="http://IP:PORT/index.html" />
<allow-navigation href="http:///" />
<preference name="Fullscreen" value="true" />

签名

keytool -genkey -v -keystore release-key.keystore -alias cordova-demo -keyalg RSA -keysize 2048 -validity 10000
vi build.json

{
  "android": {
    "release": {
      "keystore": "release-key.keystore",
      "alias": "cordova-demo",
      "storePassword": "password",
      "password": "password"
    }
  }
}

禁用缓存

import android.webkit.WebSettings;
import android.webkit.WebView;
@Override
protected void onResume() {
    super.onResume();
    // Disable caching ..
    WebView wv = (WebView) appView.getEngine().getView();
    WebSettings ws = wv.getSettings();
    ws.setAppCacheEnabled(false);
    ws.setCacheMode(WebSettings.LOAD_NO_CACHE);
    loadUrl(launchUrl); // launchUrl is the default url specified in Config.xml
}

相关文章

网友评论

      本文标题:Cordova常用操作

      本文链接:https://www.haomeiwen.com/subject/xunppttx.html