Make as Default SMS Application

madSac

Active Member
Licensed User
Longtime User
I want to make my SMS application as default smsing application.
Like on hitting send option comes to select an app to send SMS & make it default too
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

madSac

Active Member
Licensed User
Longtime User
You can add an intent filter as described here: Making alternative SMS sender default in Android - Stack Overflow
See also this tutorial (about intent filters): Intent Filters - Intercepting SMS messages in the background

It will most probably not work from other SMS apps as they send the messages directly (compared to sending intents).
i used below code but it didn't worked...?
AddManifestText(
<activity android:name="MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<action android:name="android.intent.action.SENDTO" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="sms" />
<data android:scheme="smsto" />
</intent-filter>
</activity>)
 
Upvote 0

madSac

Active Member
Licensed User
Longtime User
Have you followed the steps I wrote in post #2? The user should be able to choose your app.
yes, I followed may be I would be wrong somewhere
Sorry,
But can you please post the code........


I am again sorry if I irritated you.......
 
Upvote 0

madSac

Active Member
Licensed User
Longtime User
It worked ...but how to get mobile number of selected contact to an object/variable ?
<code>
AddActivityText(main,<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>)</code>
 
Upvote 0

madSac

Active Member
Licensed User
Longtime User
done thank you for guiding me
i used below code
B4X:
Dim tmpint As Intent
Dim su As StringUtils
tmpint=Activity.GetStartingIntent
If tmpint.Action="android.intent.action.SENDTO" Then
Dim splt() As String
splt=Regex.Split(":", tmpint.GetData)
tomobile.text=su.DecodeUrl(splt(1),"UTF8")
End If
 
Upvote 0
Top