繁体   English   中英

电话差距代码不起作用

[英]Phone gap code is not working

联系方式

 <script type="text/javascript" charset="utf-8" src="cordova-1.7.0.js"></script> <script type="text/javascript" charset="utf-8"> // Wait for Cordova to load // document.addEventListener("deviceready", onDeviceReady, false); // Cordova is ready // function onDeviceReady() { var myContact = navigator.contacts.create({"displayName": "Test User"}); myContact.note = "This contact has a note."; console.log("The contact, " + myContact.displayName + ", note: " + myContact.note); } </script> </head> <body> <h1>Example</h1> <p>Create Contact</p> </body> </html> 

我编译了此代码,并尝试在我的android联系人上未创建测试用户”

创建联系人并填充属性后,添加save()

function onDeviceReady() {
    var myContact = navigator.contacts.create({"displayName": "Test User"});
    myContact.note = "This contact has a note.";
    myContact.save(function() {
        console.log("contact saved");
    },
    function() {
        console.log("could not save contact");
    });
    console.log("The contact, " + myContact.displayName + ", note: " + myContact.note);
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM