Getting Started with Kapsel – Part 18 — Calendar
Calendar (New in SP06)
This plugin enables the ability to find, create and delete calendar entries in the Android or iOS calendar. It uses the open source Calendar plugin.
For additional details on the Kapsel Calendar plugin see the JavaScript file in a project that includes this plugin at
project_name\plugins\com.sap.mp.cordova.plugins.calendar\www\calendar.js
or the JS Documentation at Kapsel Calendar API Reference.
The following steps will demonstrate an example of using this plugin.
- Create the project.
cordova -d create C:\Kapsel_Projects\CalendarDemo com.mycompany.calendar CalendarDemo "{\"plugin_search_path\":\"C:/SAP/MobileSDK3/KapselSDK/plugins/\"}" cd C:\Kapsel_Projects\CalendarDemo cordova -d platform add android cordova -d create ~/Documents/Kapsel_Projects/CalendarDemo com.mycompany.calendar CalendarDemo "{\"plugin_search_path\":\"/Users/i826567/SAP/MobileSDK3/KapselSDK/plugins/\"}" cd ~/Documents/Kapsel_Projects/CalendarDemo cordova -d platform add ios
- Add the device plugin and the Kapsel or open source calendar plugin.
cordova -d plugin add org.apache.cordova.device
cordova -d plugin add nl.x-services.plugins.calendar
or
cordova -d plugin add https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin - Replace www\index.html with the contents of index.html.
- Copy the files to the platform directory by running
cordova -d prepare
- Use the Android IDE or Xcode to deploy and run the project.
Press the Create Event button, then the Find Event button. Open the device calendar.
Note the Create Recurring, Open Calendar and List Calendar buttons only work with the open source version of the Calendar plugin.
The open source Calendar plugin also contains additional methods that are platform specific. For example the Android version contains a method calendar.createEventInteractively that when called creates an entry and then displays it in the calendar and the iOS version has methods named calendar.createCalendar and calendar.createEventInNamedCalendar.
I think this demo is wrong. It is PhoneGap Calendar plugin but not Kapsel Calendar plugin.
Kapsel Calendar plugin only provides 3 APIs w/o any UI.
The screen shot of the calendar is the device's calendar showing the result of calling calendar.createEvent.
You can use either the open source calendar plugin or the Kapsel one. This example should work with either plugin.
Hope that helps,
Dan van Leeuwen
Kapsel Calendar plugin is different with the open source one.
This demo has 6 buttons to invoke 6 APIs from the plugin
But Kapsel Calendar plugin provides only 3 APIs to createEvent, listEvent and deleteEvent.
Other 3 APIs such as create recurring event, open calendar and list calendar are provided by the opensource calendar plugin only.