cancel
Showing results for 
Search instead for 
Did you mean: 

Use the google calendar api in my cap/mdk application

Thiagoc789
Participant
0 Kudos

Hello experts, I have a requirement to improve my mdk application which has the calendar but I want to synchronize it with the Google Calendar API so that when creating an event in the application it is reflected in the Google Calendar and vice versa. I understand that I need to use another authentication within the application but I can't find documentation or steps to follow and I find myself lost. Any help would be greatly appreciated.

Greetings

Santiago

View Entire Topic
mingkho
Advisor
Advisor
0 Kudos

Hi Santiago

The best approach is probably to write your Google Calendar use as a NativeScript (NS) plugin and then consume that inside your MDK application. That way you can avoid having to write native Android code using JavaScript in your MDK app (via Marshalling).

You can consider to design it as an independent NS plugin that provide generic Google Calendar usage.

Your MDK app will then consume the plugin e.g. calling the your exported API methods to handle secondary authentication, creating calendar entry or retrieving entries, etc.

That will also allow you to re-use the plugin in any other MDK projects should the need arise.

Here's a useful blog that show similar approach of creating your own NS plugin and consume it in MDK:

https://blogs.sap.com/2022/05/17/createmigratepublish-native-script-plugins-and-consume-in-an-mdk-ap...

Regards

Ming

Thiagoc789
Participant
0 Kudos

I am currently using this calendar to create events, in my requirement the only thing necessary is to synchronize that when I send an event from my application, it is seen in my Google calendar. Can I still use this nativescript plugin and edit it in some way or just focus on the apis? Or is the best approach still to create your own from scratch? Thank you

Calendar View Extension App

mingkho
Advisor
Advisor
0 Kudos

The Calendar View Extension you linked is not a NativeScript plugin. It is an MDK Extension. They are 2 different things.

You can create your own NativeScript plugin that focus on wrapping the Google Calendar APIs and then consume that include that NS plugin to your MDK project (via NSPlugins property). Then finally consume it in your MDK Extension's code by importing its modules.

You can, of course, try to consume the Google Calendar API directly from within your MDK Extension (the Calendar View Extension) via Java-to-JS marshalling (that's what Calendar View Extension is doing in their code to access android.widget.CalendarView), and include the Google Calendar libraries via the App_Resources_Merge/Android/app.gradle.