我想使用 Phonegap 模拟器来测试一个使用 Kendo UI Mobile 的应用程序。当我在真实设备上测试 Kendo UI 时,它会被初始化,仍然从未调用 Geolocation onSuccess 方法,但在 Phonegap Emulator 上我什至看不到 Kendo Ui 正在初始化。请帮我运行这个应用程序
var MYAPP = MYAPP || {};
MYAPP.onSuccess = (function(position)
{
var myLocation = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
map = new google.maps.Map(document.getElementById('map_canvas'), {
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: myLocation,
zoom: 15
});
});
MYAPP.onError = (function(error)
{
alert("error initializing map")
});
MYAPP.run = (function() {
// create the Kendo UI Mobile application
alert("kendo initialized");
MYAPP.app = new kendo.mobile.Application(document.body, { transition: "slide" });
navigator.geolocation.getCurrentPosition(MYAPP.onSuccess, MYAPP.onError);
});
MYAPP.show = (function() {
$(document.body).show();
});
(function() {
if (navigator.userAgent.indexOf('Browzr') > -1) {
// blackberry
setTimeout(MYAPP.run, 250)
} else {
// attach to deviceready event, which is fired when phonegap is all good to go.
document.addEventListener('deviceready', MYAPP.run, false);
alert("hello")
}
})();