Search code examples
androidxamarinintentfilter

Intent Filters with Android


I can't seem to figure out the app manifest for intent filters...

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" package="com.test.test" android:versionCode="1" android:versionName="1">
    <uses-sdk android:targetSdkVersion="8" />
  <application android:icon="@drawable/icon">

    <activity>
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
        <data android:scheme="myapp" />
      </intent-filter>
    </activity>
    <activity android:name=".AddNewActivity">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
        <data android:scheme="myapp" />
      </intent-filter>
    </activity>
  </application>

</manifest>

I am trying to have myapp://somesite.com/file.test open up within my app.


Solution

  • It looks like you have two activities. Both are Listed as "android.intent.action.MAIN". Only your actual main activity can have the LAUNCHER and MAIN attribute.

    Switch your second activity from 'MAIN' to 'AnyName' and 'LAUNCHER' to default.