简体   繁体   中英

Export Ionic calendar to google calendar

so i made a calendar app that displays a list of events on a given date using ionic2 calendar but i want to export the events to the native calendar on android. is There any docs that allows me to understand on how to implement such feature?

try using this ionic-native plugin

https://ionicframework.com/docs/native/calendar

From this github project: https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin

When you import the plugin in your module, then use this way:

    constructor(private calendar: Calendar) { }

    yourEvent(){
//check permission on android
     this.calendar.hasReadWritePermission().then((rta)=>{
          if (!rta){
            this.calendar.requestReadWritePermission();
            return;
          }
          this.calendar.createEventInteractively(title,location,otherNotes,startDate,endDate).then(
            (msg) => { console.log("msg "+JSON.stringify(msg)); },
            (err) => { console.log("err "+err); }


    );
    });
}

Hope it helps!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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