Share this post on:

1. Introduction

Description: Extension to prompt user to select app as default SMS application
Latest Version: 1
Last Updated:  October 23, 2021

2. Blocks

image

3. Documentation

AfterChangeIntent

Event invoked when either selects an app from intent or cancel it.Your app may or may not be set as default.


DefaultSmsAppPackage

Returns package name of current default SMS app.

Return type : text


IsRoleAvailable

Returns whether SMS app role is available or not.

Return type : boolean


IsRoleHeld

Returns whether SMS app role is held by this app or not.

Return type : boolean


LaunchChangeIntent

Lauches app chooser activity/intent where user can change default SMS app.

Params

packageName | text


4. Usages

image

5. Download

Aix: com.sunny.sms.aix (7.6 KB)

Note: App’s manifest must contain these:

<queries>
<intent>
  <action android:name="android.intent.action.SEND" />
                <action android:name="android.intent.action.SENDTO" />
  <data android:scheme="sms" />
                <data android:scheme="smsto" />
                <data android:scheme="mms" />
                <data android:scheme="mmsto" />
</intent>
</queries>
<!-- BroadcastReceiver that listens for incoming SMS messages -->
        <receiver
            android:name=".SmsReceiver"
            android:permission="android.permission.BROADCAST_SMS">
            <intent-filter>
                <action android:name="android.provider.Telephony.SMS_DELIVER" />
            </intent-filter>
        </receiver>

        <!-- BroadcastReceiver that listens for incoming MMS messages -->
        <receiver
            android:name=".MmsReceiver"
            android:permission="android.permission.BROADCAST_WAP_PUSH">
            <intent-filter>
                <action android:name="android.provider.Telephony.WAP_PUSH_DELIVER" />
                <data android:mimeType="application/vnd.wap.mms-message" />
            </intent-filter>
        </receiver>

        <!-- Activity that allows the user to send new SMS/MMS messages -->
        <activity android:name=".ComposeSmsActivity">
            <intent-filter>
                <action android:name="android.intent.action.SEND" />
                <action android:name="android.intent.action.SENDTO" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="sms" />
                <data android:scheme="smsto" />
                <data android:scheme="mms" />
                <data android:scheme="mmsto" />
            </intent-filter>
        </activity>

        <!-- Service that delivers messages from the phone "quick response" -->
        <service
            android:name=".HeadlessSmsSendService"
            android:exported="true"
            android:permission="android.permission.SEND_RESPOND_VIA_MESSAGE">
            <intent-filter>
                <action android:name="android.intent.action.RESPOND_VIA_MESSAGE" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:scheme="sms" />
                <data android:scheme="smsto" />
                <data android:scheme="mms" />
                <data android:scheme="mmsto" />
            </intent-filter>
        </service>

Also the activity you want to use must be added to SMS category.
For example,

<activity android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize" android:name=".Screen1" android:windowSoftInputMode="stateHidden">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
                <category android:name="android.app.role.SMS"/>
            </intent-filter>
        </activity>
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments