我已經寫在手機上的差距文檔以下代碼無法接取接觸website` 與PhoneGap的應用
// Wait for Cordova to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// Cordova is ready
//
function onDeviceReady() {
// find all contacts
var options = new ContactFindOptions();
var fields = ["displayName", "name"];
navigator.contacts.find(fields, onSuccess, onError, options);
}
// onSuccess: Get a snapshot of the current contacts
//
function onSuccess(contacts) {
for (var i=0; i<contacts.length; i++)
{
console.log("Display Name = " + contacts[i].displayName);
var element = document.getElementById('cont');
element.innerHTML='<li><a href="#">' + contacts[i].displayName + '</a></li>';
}
}
// onError: Failed to get the contacts
//
function onError(contactError) {
alert('onError!');
}
</script>`
它是工作在安卓模擬器罰款,但是當我安裝該應用程序的三星Galaxy手機就返回「空值」。請幫助。
什麼返回null?的onSuccess? –
成功則返回null。 –
什麼是空 - 聯繫人? –