【发布时间】:2015-08-09 12:50:00
【问题描述】:
我想知道如何在我的 PhoneGap 项目中使用 dbaq/cordova-plugin-contacts-phone-numbers 包?我使用
安装它cordova plugin add https://github.com/dbaq/cordova-plugin-contacts-phone-numbers.git
并且我在js文件中添加了contactsPhoneNumbers.js并引用了它:
<script type="text/javascript" src="js/contactsPhoneNumbers.js"></script>
我在 onDeviceReady 函数中添加了这段代码:
navigator.contactsPhoneNumbers.list(function(contacts) {
alert(contacts.length + ' contacts found');
for(var i = 0; i < contacts.length; i++) {
console.log(contacts[i].id + " - " + contacts[i].displayName);
for(var j = 0; j < contacts[i].phoneNumbers.length; j++) {
var phone = contacts[i].phoneNumbers[j];
alert("===> " + phone.type + " " + phone.number + " (" + phone.normalizedNumber+ ")");
}
}
}, function(error) {
console.error(error);
});
这对我不起作用。它说缺少 contactsPhoneNumbers.js 文件。请帮帮我!!
谢谢!
【问题讨论】:
标签: javascript android cordova phonegap-plugins phonegap-build