0
我已經實現幾個功能作爲PhoneGap的referrence指定的Android原生按鈕:自身功能沒有與PhoneGap的工作 - 科爾多瓦
JS:
var _previous;
function bindCordovaNativeHandlers(){
document.addEventListener("deviceready", onDeviceReady, false);
}
function onDeviceReady(){
document.addEventListener("menubutton", onMenuKeyDown, false);
document.addEventListener("backbutton", onBackKeyDown, false);
}
function onMenuKeyDown(){
//open function bar
$('.action').click();
}
function onBackKeyDown() {
//quit funciton
var interval = 2000,
current = Date.now();
_previous = _previous || 0;
console.log(current - _previous);
if (current - _previous <= interval) {
navigator.app.exitApp();
}
_previous = current;
}
HTML:
爲了爲了不引起我的用戶的任何懷疑,我想要求最低限度的權限(cordova插件被轉換成android權限)。
是否有需要在該功能的任何科爾多瓦插件?
插件,我已經在上次構建中刪除:
<gap:plugin name="org.apache.cordova.battery-status" />
<gap:plugin name="org.apache.cordova.camera" />
<gap:plugin name="org.apache.cordova.media-capture" />
<gap:plugin name="org.apache.cordova.console" />
<gap:plugin name="org.apache.cordova.contacts" />
<gap:plugin name="org.apache.cordova.device" />
<gap:plugin name="org.apache.cordova.device-motion" />
<gap:plugin name="org.apache.cordova.device-orientation" />
<gap:plugin name="org.apache.cordova.dialogs" />
<gap:plugin name="org.apache.cordova.file" />
<gap:plugin name="org.apache.cordova.file-transfer" />
<gap:plugin name="org.apache.cordova.geolocation" />
<gap:plugin name="org.apache.cordova.globalization" />
<gap:plugin name="org.apache.cordova.inappbrowser" />
<gap:plugin name="org.apache.cordova.media" />
<gap:plugin name="org.apache.cordova.network-information" />
<gap:plugin name="org.apache.cordova.splashscreen" />
<gap:plugin name="org.apache.cordova.vibration" />