简体   繁体   中英

How to add a Calendar event with ICS file (URL) in Android from an Intent?

I'm having an *.ics file that returned from API response and what I'm trying is to add it to users Calendar (through the Calendar Add Event activity). Would be something like this in iOS: How can I open calendar .ics files in ios?

I've been searching around but seems like there is no default action handler to add ics file from url? So far I have tried these solutions:

but none are available for handling the ICS file.

They are working fine for the same purpose but in my current situation, we want the action handlers to be the same through all platforms and using the same api response (returns a downloadable uri of .ics file).

Has anybody run into the same situation? Or if anybody knows how the Gmail works if you send/attach an ics file within (it's able to add that event to calendar)?

there is no default action handler to add ics file from url?

Correct. Android is an OS. It is not a calendar app.

Out of the thousands of Android device models, many may ship a calendar app. Out of those that do, many may ship Google Calendar, if they have licensed Google's proprietary apps. However, this means that:

  • Not all devices will have a calendar app
  • Not all devices will have Google Calendar

And, not all users want to use Google Calendar. They might want to use some other calendar app, either pre-installed on their device or downloaded from an app distribution channel, such as the Play Store.

It is up to the calendar app to offer ICS import. There is no requirement that every calendar app offer this, and there is no requirement that they do so via some Intent action that third-party apps can invoke.

IMHO, the most likely scenario for a calendar app to offer ICS import would be via ACTION_VIEW with whatever the MIME type is for .ics ( text/calendar ?). Such an activity may or may not support http or https schemes, as they may expect the ICS file to be local (eg, email attachment) and support only file and content .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM