Use the Cordova daily registrant agent

Source: Internet
Author: User



Daily registrant agent



I used the publisher plug-in,


 
 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 object
10 var contact = navigator.contacts.create();
11 contact.displayName = "Plumber";
12 contact.nickname = "Plumber";            // specify both to support all devices
13 
14 // populate some fields
15 var name = new ContactName();
16 name.givenName = "Jane";
17 name.familyName = "Doe";
18 contact.name = name;
19 
20 // save to device
21 contact.save(onSuccess,onError);


I found no response; 1 Document. addeventlistener ('deviceready', yourfunction, false); I can put the function to 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 color
12   window.plugins.calendar.createCalendar(createCalOptions,success,error);
13   window.plugins.calendar.createEventInNamedCalendar(title,location,notes,startDate,endDate,createCalOptions.calendarName,success,error);


Two data types are required.


createCalendar,
createEventInNamedCalendar


In order to hit the desired effect...



Use the Cordova daily registrant agent


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.