V
V
vostotskiy2016-02-26 15:27:58
Android
vostotskiy, 2016-02-26 15:27:58

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>

I call like this
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);

On the genymotion emulator and in google inspect, no reaction.
Please tell me how to figure out what could be the problem. Thank you.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question