【发布时间】:2017-05-11 22:20:02
【问题描述】:
我正在开发一个从手机读取联系人的 Android 应用程序 (phonegap),它在 android 5 及更高版本上运行良好,但在 android 4 操作系统上它无法从手机读取联系人,所以我想问如果有人在使用联系人时遇到此问题。在 phonegap 中查找。
document.addEventListener("deviceready", onDeviceReady, true); //the onDeviceReady function takes place when the app starts
function onDeviceReady() {
// find all contacts displayName, Name and phoneNumbers
var fields = ["displayName", "name", "phoneNumbers"];
var options = new ContactFindOptions();
options.filter = "";
options.multiple = true;
navigator.contacts.find(fields, onSuccess, onError, options);
var currentdate = new Date();
var datetime = currentdate.getDate() + "-"+(currentdate.getMonth()+1)
+ "-" + currentdate.getFullYear() + "T" + currentdate.getHours() + ":"
+ currentdate.getMinutes() + ":" + currentdate.getSeconds();
alert(datetime);
}
【问题讨论】:
-
能贴出代码sn-p吗?
-
刚刚发布了
标签: javascript android cordova phonegap-plugins cordova-plugins