jasonsalzman / react-add-to-calendar

A simple, customizable, and reusable Add to Calendar button component for React
https://jasonsalzman.github.io/react-add-to-calendar/
MIT License
180 stars 124 forks source link

No support for Google calendar in Android Phones. #7

Closed dkaushik95 closed 7 years ago

dkaushik95 commented 7 years ago

Since Google has separated its Google Calendar. They also have an android app which handles URL and converts it into an intent. This intent can directly fire the Calendar app to start and prompt to create a new event. It would be awesome if we could have support for such URL's .

This is a preview of the intent implemented in android.

String date = cursor.getString(cursor.getColumnIndex(AnnouncementTable.FIELD_DEADLINE));
            String[] days = date.split("-");
            Calendar begintime = Calendar.getInstance();
            begintime.set(Integer.parseInt(days[0]), Integer.parseInt(days[1]) - 1, Integer.parseInt(days[2]), 7, 30);
            Calendar endtime = Calendar.getInstance();
            endtime.set(Integer.parseInt(days[0]), Integer.parseInt(days[1]) - 1, Integer.parseInt(days[2]), 8, 30);
            Intent intent = new Intent(Intent.ACTION_INSERT)
                    .setData(CalendarContract.Events.CONTENT_URI)
                    .putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, {START_DATE})
                    .putExtra(CalendarContract.EXTRA_EVENT_END_TIME, {END_DATE})
                    .putExtra(CalendarContract.Events.TITLE, {TITLE})
                    .putExtra(CalendarContract.Events.DESCRIPTION, {DESCRIPTION})
                    .putExtra(CalendarContract.Events.EVENT_LOCATION, {LOCATION})
                    .putExtra(CalendarContract.Events.AVAILABILITY, CalendarContract.Events.AVAILABILITY_BUSY);
            startActivity(intent);
jasonsalzman commented 7 years ago

This is now resolved in version 0.0.9 from your PR #6