cordova 日曆 聯系人 外掛程式使用

來源:互聯網
上載者:User

標籤:style   blog   http   color   io   os   使用   ar   sp   

日曆外掛程式 聯係人外掛程式

我用聯係人外掛程式,

 1 function onSuccess(contact) { 2     alert("Save Success"); 3 }; 4  5 function onError(contactError) { 6     alert("Error = " + contactError.code); 7 }; 8  9 // create a new contact object10 var contact = navigator.contacts.create();11 contact.displayName = "Plumber";12 contact.nickname = "Plumber";            // specify both to support all devices13 14 // populate some fields15 var name = new ContactName();16 name.givenName = "Jane";17 name.familyName = "Doe";18 contact.name = name;19 20 // save to device21 contact.save(onSuccess,onError);

我發現沒有反應; 1 document.addEventListener(‘deviceready‘, yourfunction, false); 我把添加到聯系人的函數放到yourfunction 中就可以了

 1 var startDate = new Date(2014,2,24,0,0,0,0,0); 2   var endDate = new Date(2014,2,25,0,0,0,0,0); 3   var title = "My nice events"; 4   var location = "Home"; 5   var notes = "Some notes about this event."; 6   var success = function(message) { alert("Success: " + JSON.stringify(message)); }; 7   var error = function(message) { alert("Error: " + message); }; 8   // if you want to create a calendar with a specific color, pass in a JS object like this: 9   var createCalOptions = window.plugins.calendar.getCreateCalendarOptions();10   createCalOptions.calendarName = "My Cal Name";11   createCalOptions.calendarColor = "#FF0000"; // an optional hex color (with the # char), default is null, so the OS picks a color12   window.plugins.calendar.createCalendar(createCalOptions,success,error);13   window.plugins.calendar.createEventInNamedCalendar(title,location,notes,startDate,endDate,createCalOptions.calendarName,success,error);

需要二個函數

createCalendar,
createEventInNamedCalendar

才能打到我要的效果....囧

cordova 日曆 聯系人 外掛程式使用

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.