Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Launch Android app from within SMS/MMS message?

Tags:

android

sms

Is it possible to to launch an application using a URL launched from within the Android messaging app (SMS or MMS)?

like image 278
steve Avatar asked Jun 21 '10 17:06

steve


People also ask

How do I open SMS app on Android?

Open Settings . Click Apps. In the list of apps, click Messages. SMS.

How we can send and receive SMS in Android application?

The user can tap the messaging icon in your app to send the message. In the messaging app launched by the intent, the user can tap to send the message, or change the message or the phone number before sending the message. After sending the message, the user can navigate back to your app using the Back button.

How can send SMS to multiple numbers in android programmatically?

How can send SMS to multiple numbers in android programmatically? You can't do this via Intent, as the android SMS app doesn't allow multiple recipients. You can try using the SmsManager class. First of all you need to request the permission android.


3 Answers

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.

like image 68
Adam Nemitoff Avatar answered Oct 28 '22 18:10

Adam Nemitoff


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.

like image 6
Umesh Aawte Avatar answered Oct 28 '22 17:10

Umesh Aawte


No, the only URL recognized are:

  • Web URLs.
  • Email addresses.
  • Phone numbers.
  • Map addresses.

From TextView's android:autoLink XML attribute.

like image 3
Macarse Avatar answered Oct 28 '22 16:10

Macarse