Android Question How to access default SMS manager

ThRuST

Well-Known Member
Licensed User
(B4A) Hello I wonder how to start the default SMS manager intent in android? I have tried the packagemanager without luck, but I can read email that way but not SMS.

I can access the phones settings this way, perhaps it makes it easier.

Dim intent1 As Intent
intent1.Initialize("android.settings.WIFI_SETTINGS", "")
StartActivity(intent1)

Anyone?
 

NJDude

Expert
Licensed User
Something like this:
B4X:
Private i As Intent

i.Initialize(i.ACTION_VIEW, "sms:")
i.PutExtra("sms_body", "Hello There!")

StartActivity(i)
 

ThRuST

Well-Known Member
Licensed User
Thanks NJDude. I allready know how how to send SMS, I need to read them from intent and not any list (SMS main menu) from the SMS manager as specified in my post. Can you solve it? :)
 

ThRuST

Well-Known Member
Licensed User
I was hoping there was an intent available to access the 'SMS inbox message handler'. A running service was not really the prime answer to this question. Thanks anyway.
This is the closest I could get:

Dim intent1 As Intent
intent1.Initialize("android.provider.Telephony.SMS_RECEIVED")
StartActivity(intent1)

Perhaps you or someone else can help me solve it by looking at this page:
http://developer.android.com/reference/android/telephony/SmsManager.html
 

ThRuST

Well-Known Member
Licensed User
I solved this myself. Here's how to start the SMS inbox handler:

' Start SMS handler intent
Dim PM As PackageManager
Dim StartIntent As Intent
Dim iStr As String
Dim Packages As List

Packages = PM.GetInstalledPackages
For i = 0 To Packages.size - 1
iStr=Packages.Get(i)

If iStr.Contains("mms") = True Then
StartIntent=PM.GetApplicationIntent(iStr)
If StartIntent.IsInitialized Then StartActivity(StartIntent)
Exit
End If
Next
 

NJDude

Expert
Licensed User
You could also do this:
B4X:
Private i As Intent

i.Initialize(i.ACTION_MAIN, "")
i.SetType("vnd.android-dir/mms-sms")

StartActivity(i)
 
Top