6

I searched for this topic and found these two websites:

Get content uri from file path in android

http://developer.android.com/training/basics/intents/sending.html

What I want to do is export an ical file from within an Android app and import the calendar to the google calendar app. So if I click on a button, my app should send an intent and the Android App Chooser should come up. Then I want to be able to choose google calendar and have the calendar to import the ical file.

This is my code so far:

Uri uri = Uri.fromFile(new File(fileName));
//Uri uri = Uri.parse(fileName);
Intent calendarIntent = new Intent(Intent.ACTION_VIEW, uri);
final Intent chooser = Intent.createChooser(calendarIntent, "choose");
...
startActivity(chooser);

I'm able to open the file using fileName, so this shouldn't be an issue (fileName just contains something like "file.ics"). If I run this code the android app chooser says that there is no app able to handle this action. I'm using Google API level 7 as library within Eclipse and I deploy to a Galaxy Nexus device with Android 4.04 for testing. I can't figure out what I'm doing wrong. Any suggestions? Thanks in advance for any help!

EDIT:

The following code brings up a list of apps to choose from:

Uri uri = Uri.parse(fileName);
Intent calendarIntent = new Intent(Intent.ACTION_SEND, uri);
calendarIntent.setType("text/calendar");
final Intent chooser = Intent.createChooser(calendarIntent, "choose");

But the calendar is not in this list. So I downloaded the ical file on my phone and tried to open it. Even then only text editors but no calendar apps come up. So it seems to me that it's not possible to import ical files to the google calendar app. I'd be happy to be proven wrong...

Community
  • 1
  • 1
leche43
  • 71
  • 6
  • yeah looks bad: http://code.google.com/p/android/issues/detail?id=1257 http://code.google.com/p/android/issues/detail?id=2361 Heres a solution to set every event individual: http://www.developer.com/ws/android/programming/Working-with-the-Android-Calendar-3850276.htm The second link in my question also describes how to do that using api level 14 or higher. – leche43 Jun 14 '12 at 16:08

0 Answers0