euniceadu
euniceadu

Reputation: 858

how to set an app as an sms app android

I have developed an android app that sends sms. My problem is that when I click the text message icon for a contact, the pop up that asks you to specify which application you will like to use, does not have my app as part of the options. Can anybody help with this?

I have added an image to make the question much clearer.

https://i.sstatic.net/itFvN.png

This is the code for the manifest file:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.smsmessaging"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="15" />

<uses-permission android:name="android.permission.SEND_SMS">
</uses-permission>
<uses-permission android:name="android.permission.RECEIVE_SMS">
</uses-permission>

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity android:name=".SMS"
              android:label="@string/app_name">
        <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.SEND"/>
            <category android:name="android.intent.category.DEFAULT"/>
            <data android:mimeType="text/plain" />
        </intent-filter>
    </activity>
    <receiver android:name=".Receiver"> 
        <intent-filter> 
            <action android:name=
                "android.provider.Telephony.SMS_RECEIVED" /> 
        </intent-filter> 
    </receiver>

</application>

Upvotes: 0

Views: 1042

Answers (2)

euniceadu
euniceadu

Reputation: 858

I finally figured out how to do it. All I had to do was add the intent-filter bellow to the activity:

        <intent-filter>
              <action android:name="android.intent.action.SENDTO"/>
              <category android:name="android.intent.category.DEFAULT" />
              <data android:scheme="sms" />
              <data android:scheme="smsto" />
        </intent-filter>

Upvotes: 2

jb11
jb11

Reputation: 557

You need to have an <intent-filter> for the ACTION_SEND action. This will put it in the list

http://developer.android.com/guide/components/intents-filters.html

This example is from the Google page:

<intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <action android:name="android.intent.action.EDIT" />
            <action android:name="android.intent.action.PICK" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="vnd.android.cursor.dir/vnd.google.note" />
</intent-filter>

Pay attention to the data element

Upvotes: 0

Related Questions