[英]Phonegap: onDeviceReady override
我有一個專為android構建的phonegap項目,並使用cordova。 我在這個phonegap項目中植入了一個基於Web的應用程序。 這個應用程式有一個html頁面,index.html。 在此索引文件中,不會調用onDeviceReady()函數。 但是,此頁面工作完美,只是從mainactivity調用了該頁面,並且由於某種原因它沒有進入此功能。 Cordova函數可能會覆蓋它。 問題:如何使此函數在index.html文件中工作? 哪個功能可以替代/替換此功能?
function onLoad() { document.addEventListener("deviceready", onDeviceReady, false); } // device APIs are available // function onDeviceReady() { // Register the event listener document.addEventListener("backbutton", onBackKeyDown, false); } // Handle the back button // function onBackKeyDown(e) { e.preventDefault(); navigator.notification.confirm("×”×?×? ×'×¨×¦×•× ×? ×?צ×?ת?", onConfirm, "יצי×?×”", "יצי×?×”,×'יטו×?"); } function onConfirm(button) { if(button==2){//If User selected No, then we just do nothing return; }else{ navigator.app.exitApp();// Otherwise we quit the app. } }
此處發生的是調用了onLoad,而從未調用過 onDeviceReady 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.