SmsAppTools: Ask user to select your app as default SMS App

1. Introduction

Description: Extension to prompt user to select app as default SMS application
Latest Version: 1
Last Updated: 2021-10-22T18:30:00Z

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>
14 Likes

Epic ! @vknow360

1 Like

Just curious. Will this be accepted if you upload such an app to Google Play?

4 Likes

Actually what happen with this extension

Yes, but only if the developer explains why he needs to access SMS (or Call Logs in general case).
However, the extension doesn't add any permission to the manifest and most of the work needs to be done manually by the developer.

2 Likes

Great Work. I was wondering if you can add the user permission to select sim1 or sim2 to send messages in case there are two sims in a cell phone.

Sure, if you can sponsor the new method(s).

1 Like

Plz tell us how to use blocks properly, I cannot use it


w
i follow the rules but it gave me error,

Use a correct package name
Taifun

How could I get the correct package name?

The answer is only a short search in the community away...
For example

Taifun

1 Like