I am trying to figure out how to start an app from a URL, and how I should write that URL.
I have the following code in my AndroidManifest:
<activity android:name=".MyActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"></action>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.LAUNCHER"></category>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:host="my.app" android:scheme="http"></data>
</intent-filter>
</activity>
I used a URL as explained in this answer, but nothing happens.
Please let me know if my intent is well written, and how I should write the URL that calls that app, and note that I need to call my "Main" Activity.
You need to have two <intent-filter>
elements for this <activity>
. One will be for MAIN
and LAUNCHER
. The other will be for VIEW
, BROWSABLE
/DEFAULT
, and your <data>
element:
<activity android:name=".MyActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"></action>
<category android:name="android.intent.category.LAUNCHER"></category>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:host="my.app" android:scheme="http"></data>
</intent-filter>
</activity>
Then, http://my.app
should launch your activity.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With