Search code examples
node.jsionic-frameworkionic2google-calendar-api

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?


Solution

  • 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!