Reputation: 183
Is it possible to to launch an application using a URL launched from within the Android messaging app (SMS or MMS)?
Upvotes: 18
Views: 19817
Reputation: 4690
In addition answer given by @Adam,
There is multiple intent filter possible in case of android app, We have to use two. One for the app launcher and one for the launching app using the URL in sms
<activity android:name="com.SomeActivity" adroid:theme="@style/MyTheme"
android:label="@string/app_name">
<!-- For app launcher -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="com.YorAppPackage" />
</intent-filter>
<!-- To open app using link -->
<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:scheme="http"
android:host="yourdomain.com"
android:pathPrefix="/someurlparam">
</data>
</intent-filter>
</activity>
Now add a URL in your sms something like
http://yourdomain.com/someurlparam
This should launch the app on url click and will add a app icon in android as well.
Upvotes: 6
Reputation: 615
The previous answer was not correct.
You can add an intent filter for an activity that will "register" your app to handle hyperlinks within the SMS body.
For instance, if you add the following intent to your application.xml:
<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:scheme="http"
android:host="test.com"
android:pathPrefix="/myapp">
</data>
</intent-filter>
And you send an SMS message with the following in the body:
http://test.com/myapp/somedata
Your application will launch and the activity will be able to access the URL as part of the intent data.
Upvotes: 46
Reputation: 93183
No, the only URL recognized are:
From TextView's android:autoLink XML attribute.
Upvotes: 3