I would like to know if we can have a link in a SMS that would be handle by my application. For example a link which would look like myapp://blabla. And by clicking on it myapp would be open with the link as an argument.
This question also refers to email, either from a file with a special extension or a link like in the SMS.
Thanks a lot for your help.
Edit 31/01
Actually, I did what Greg suggested it but it doesn't work. Such a link (myapp://blabla) is not clickable in a SMS/email...When I replace myapp with http as a scheme, it works (Android asks me wether it should open the link with myapp or the browser). But myapp://blabla isn't clickable with myapp as a scheme. Here is my code:
<application android:icon="@drawable/icon" android:label="@string/app_name"
android:debuggable="true">
<activity android:name=".myapp"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar"
android:launchMode="singleTask"
android:screenOrientation="portrait">
<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.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="myapp" android:host="blabla" />
</intent-filter>
</activity>
<activity android:name=".SecondActivity"></activity>
<activity android:name=".SettingsActivity"></activity>
</application>
Yep you can with an intent filter.
Basically in your android Manifest, choose an activity that you want to be the one that handles the given url.
<activity android:name=".myactivies.MyActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:scheme="myapp" android:host="blabla" />
</intent-filter>
</activity>
Then inside your activity you can get the url by calling getData() on the intent.
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