I know, I know, in my android manifest I already declared the permissions! But perhaps at the wrong place?
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
<uses-permission android:name="android.permission.READ_CALENDAR" />
<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
//Lots of activities here
</application>
Yet, it's still giving me an error saying permission denied, you need to get either android.permission.READ_CALENDAR or WRITE_CALENDAR. I'm trying to insert an event into the default calendar. The following is my code:
Calendar begin = Calendar.getInstance();
            begin.set(dp.getYear(), dp.getMonth(), dp.getDayOfMonth(), tp.getHour(), tp.getMinute());
            long beginMillis = begin.getTimeInMillis();
            long endMillis = beginMillis + 1800000;
            String eventUriString = "content://com.android.calendar/events";
            ContentResolver cr = getContentResolver();
            ContentValues values = new ContentValues();
            values.put(Events.DTSTART, beginMillis);
            values.put(Events.DTEND, endMillis);
            values.put(Events.TITLE, "Flashcards Review: " + deckName);
            values.put(Events.CALENDAR_ID, 1);
            values.put(Events.EVENT_TIMEZONE, TimeZone.getDefault().getID());
            Uri eventUri = cr.insert(Uri.parse(eventUriString), values);
I couldn't really find a good tutorial so I don't know if this code even makes sense... Sorry! Please help!