can't create event in google calendar with android app in some devices

2020-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);

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:// (Unknown URL content://