favorite 
<http://stackoverflow.com/questions/34196401/open-my-application-from-calendar/34201682?noredirect=1#>

I'm trying to open my android application from calendar event using 
CUSTOM_APP_URI.

   1. So i insert an event to Calendar through my application.
   2. Opening Calendar app, and navigating to the event details.
   3. Clicking on the event URI, my app should open from calendar events 
   details page.

Here is the code i used for inserting the events into calendar

@Overrideprotected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Calendar beginCal = Calendar.getInstance();
    beginCal.set(2015, 11, 10, 4, 30);
    long startTime = beginCal.getTimeInMillis();

    Calendar endCal = Calendar.getInstance();
    endCal.set(2015, 11, 10, 4, 30);
    long endTime = endCal.getTimeInMillis();

    ContentValues values = new ContentValues();
    values.put(CalendarContract.Events.CALENDAR_ID, 1);
    values.put(CalendarContract.Events.TITLE, "Check Demo Calendar4");
    values.put(CalendarContract.Events.DTSTART, startTime);
    values.put(CalendarContract.Events.DTEND, endTime);
    values.put(CalendarContract.Events.EVENT_TIMEZONE, 
TimeZone.getDefault().getID());

    values.put(CalendarContract.Events.CUSTOM_APP_PACKAGE, getPackageName());
    values.put(CalendarContract.Events.CUSTOM_APP_URI, "calendar://1");

    getContentResolver().insert(CalendarContract.Events.CONTENT_URI, values);
}

Calendar displaying the ever perfectly but Problem is even after inserting 
the event, calendar doesn't show the URI in my calendar event's detail 
page. What is wrong inserting the vent with CUSTOM_APP_URI? I would like to 
launch an activity, when user clicks on Calendar event? Any help?

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/a37dbce7-9b93-4fd7-a8cc-f3a15b6a0e29%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to