can't create event in google calendar with android app in some devices2020-03-04 android android-studio google-calendar-api android-calendar
I want to add event in google calendar from my android application.I used google api for insert event. I also added permission for read write calendar. Here is the code,
Calendar beginTime = Calendar.getInstance(); beginTime.set(2020, Calendar.MARCH, 4, 10, 30); ContentResolver cr = getContext().getContentResolver(); ContentValues values = new ContentValues(); values.put(Events.DTSTART, beginTime.getTimeInMillis()); values.put(Events.DTEND, beginTime.getTimeInMillis()); values.put(Events.TITLE, eventName); values.put(Events.DESCRIPTION, editDescription.getText().toString()); values.put(Events.CALENDAR_ID, calID); values.put(Events.EVENT_TIMEZONE, Constant.UTC_TIME_ZONE); @SuppressLint("MissingPermission") Uri uri = cr.insert(CalendarContract.Events.CONTENT_URI, values);
This is working on some devices but not working other devices like Nokia 3.4,Samsung S6,etc. It showing error as
2020-03-04 ? W/ContentResolver: Failed to get type for: content://com.android.calendar (Unknown URL content://com.android.calendar)
- Can't create handler inside thread that has not called Looper.prepare()
- Android ADB device offline, can't issue commands
- Android Studio doesn't see device
- Is there a unique Android device ID?
- Android "Only the original thread that created a view hierarchy can touch its views."
- How to make an Android device vibrate?
- How do I create a transparent Activity on Android?
- Android error: Failed to install *.apk on device *: timeout
- How can we add sms programatically in sim card in android