How do I create an activity which supports certain file types clicked in the web browser?
Here's what I tried:
AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.sf.asap" android:versionCode="212" android:versionName="2.1.2">
<application android:label="@string/app_name" android:icon="@drawable/icon">
<activity android:name=".FileSelector" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Player" android:label="@string/playing">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="file" android:host="*" />
<data android:scheme="http" android:host="*" />
<data android:scheme="https" android:host="*" />
<data android:pathPattern=".*\\.sap" />
<data android:pathPattern=".*\\.cmc" />
<data android:pathPattern=".*\\.cm3" />
<data android:pathPattern=".*\\.cmr" />
<data android:pathPattern=".*\\.cms" />
<data android:pathPattern=".*\\.dmc" />
<data android:pathPattern=".*\\.dlt" />
<data android:pathPattern=".*\\.mpt" />
<data android:pathPattern=".*\\.mpd" />
<data android:pathPattern=".*\\.rmt" />
<data android:pathPattern=".*\\.tmc" />
<data android:pathPattern=".*\\.tm8" />
<data android:pathPattern=".*\\.tm2" />
</intent-filter>
</activity>
</application>
</manifest>
Fragment of Player.java:
Uri uri = getIntent().getData();
InputStream is = getContentResolver().openInputStream(uri);
When I enter an URL in the browser (Android 1.6) I get:
E/AndroidRuntime(12026): Caused by: java.lang.RuntimeException: java.io.FileNotFoundException: No content provider: http://asap.sourceforge.net/X_Ray_2.sap
E/AndroidRuntime(12026): at net.sf.asap.Player.onCreate(Player.java:109)
E/AndroidRuntime(12026): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
E/AndroidRuntime(12026): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)