Answer the question
In order to leave comments, you need to log in
How to add an event to Android calendar using Cordova app?
Hello. I'm making an application in Cordova, I need to add some message to the calendar.
In the Manifesto I add permissions.
Here is my manifest.
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="io.cordova.hellocordova" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name" android:supportsRtl="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="@string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23" />
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
</manifest>
function add_to_calendar(elemet) {
document.addEventListener("deviceready", function () {
var startDate = new Date(date);
var endDate = new Date(date);
var title = event.description;
var location = event.territory;
var notes = event.description;
var success = function (message) {
alert('Event was added to your calendar');
};
var error = function (message) {
alert("Error: " + message);
};
window.plugins.calendar.createEventInNamedCalendar(title, location, notes, startDate, endDate, 'maps', success, error);
}, false);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question