URL Intent Filter

I am trying to register my Android app as an iCal URL handler. To do this, I set intent filters in my manifest for pseudotherapy webcal:// and for HTTP URLs using the text/calendar MIME type (see below).

This works fine in the emulator, but I have problems on the real device. The webcal:// filter works, but text/calendar does not. Instead, the browser displays the ical file as plain text instead of passing the URL to my application.

I checked that the browser is not configured as the default handler for ical (in Settings-> Applications-> Browser), and I asked several other people if they could reproduce the problem on their mobile phones. All with the same result.

What is the correct registration method for a text / calendar url?

 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.splitbrain.giraffe" android:versionName="0.31" android:versionCode="4"> <uses-sdk android:minSdkVersion="4" /> <uses-permission android:name="android.permission.INTERNET"></uses-permission> <application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.Light.NoTitleBar"> <activity android:label="@string/app_name" android:name="MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter> <category android:name="android.intent.category.BROWSABLE"></category> <action android:name="android.intent.action.VIEW"></action> <data android:mimeType="text/calendar" android:scheme="http"></data> <category android:name="android.intent.category.DEFAULT"></category> </intent-filter> <intent-filter> <category android:name="android.intent.category.BROWSABLE"></category> <action android:name="android.intent.action.VIEW"></action> <data android:scheme="webcal"></data> <category android:name="android.intent.category.DEFAULT"></category> </intent-filter> </activity> <activity android:name="OptionsActivity"></activity> <activity android:name="DetailActivity"></activity> <activity android:name="AboutActivity"></activity> </application> </manifest> 

Update:. It turns out that this works fine in the Android 1.6 emulator, but not on the 2.3.3 emulator, where it shows the same behavior as on my phone. Perhaps this is a bug on Android?

+7
source share
2 answers

Just use the DEFAULT category, the BROWSABLE category may cause problems.

Add a .*.ics path template to capture all files that have been assigned the mime type on the server

Put all data mappings in the same filter

 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="org.splitbrain.giraffe" android:versionName="0.31" android:versionCode="4"> <uses-sdk android:minSdkVersion="4" /> <uses-permission android:name="android.permission.INTERNET"></uses-permission> <application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.Light.NoTitleBar"> <activity android:label="@string/app_name" android:name="MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <data android:mimeType="text/calendar" /> <data android:scheme="webcal" /> <data android:pathPattern=".*.ics" /> </intent-filter> </activity> <activity android:name="OptionsActivity"></activity> <activity android:name="DetailActivity"></activity> <activity android:name="AboutActivity"></activity> </application> </manifest> 
0
source
0
source

All Articles