android – CalendarContract.Events.EVENT_TIMEZONE is not working in samsung device-ThrowExceptions

Exception or error:

I am trying to insert some events with some predefined timezone into android native calendar from my application. Somehow it is not working in Samsung devices. It is working fine in Pixel devices. Below is the code snippet for the same.

Intent intent = new Intent(Intent.ACTION_INSERT);
intent.putExtra(CalendarContract.Events.EVENT_TIMEZONE, "America/Los_Angeles");
intent.putExtra(CalendarContract.Events.TITLE, "test");
intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, getDateTimeyyyymmddHHmm());
intent.putExtra(CalendarContract.Events.ALL_DAY, false);
intent.putExtra(CalendarContract.Events.DURATION, "PT1H");
startActivityForResult(intent, 1);

 public static Long getDateTimeyyyymmddHHmm() {
    TimeZone timeZone = TimeZone.getTimeZone("America/Los_Angeles");

    DateFormat dateFormat2 = new SimpleDateFormat("yyyyMMdd, HHmm", Locale.US);
    Date d4 = null;
    try {
        d4 = dateFormat2.parse(new StringBuilder("20200116").append(", ").append("1045").toString());
        return d4.getTime();
    } catch (ParseException e) {
        return 0L;

Tried many ways and din’t work. Any help in resolving the device specific issue would be helpful.

How to solve:

EVENT_TIMEZONE exists in CalendarContract.EventsColumns.

You can find here:

Leave a Reply

Your email address will not be published. Required fields are marked *