My app opens when I click on the url in Android

I defined an intent filter to launch an application from several types of URLs. The fact is that it runs for all types of links, and I only want to run it for a specific hostname. Here is my manifest:

    <activity
        android:name="com.imin.SplashActivity"
        android:label="@string/app_name"
        android:launchMode="singleTask"
        android:logo="@drawable/img_action_icon"
        android:screenOrientation="portrait"
        android:theme="@style/AppTeme.Fullscreen" >
        <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" />
            <category android:name="android.intent.category.BROWSABLE" />

            <data
                android:host="imintheapp.com"
                android:pathPrefix="/events/get/"
                android:scheme="http" />
        </intent-filter>
    </activity>

I only need to open my application in the following cases: http://imintheapp.com/events/get/xxxxxxxx , where xxxxxxxx is an alphanumeric string.

What am I doing wrong? Yours faithfully,

+4
source share
3 answers

Add this code to Menifest.xml

           <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:host="www.parag-chauhan.com"
                    android:path="/test"
                    android:scheme="http" />
            </intent-filter>

For the test, create another project and run the code

Intent i = new Intent(Intent.ACTION_VIEW , Uri.parse("http://www.parag-chauhan.com/test"));
startActivity(i);

pass parameter http://paragchauhan2010.blogspot.com/2013/03/make-link-in-android-browser-start-up.html

+3

<data
            android:host="imintheapp.com"
            android:path="/events/get/"
            android:scheme="http" />
+1

, intent-filter Mainfest. , data .

.

2- Que.

+1

All Articles