Android Question how to send an SMS (november 2023)

vangogh

Active Member
Licensed User
Longtime User
hello

OK, I REALLY read many many threads about this,
but some are old, some says "it cannot be done anymore", some says "yes, it can be done" but when i run them I get an error...
and yes, I can send sms using an intent - it works, not useful to me



So, NOW, how can I send an SMS, (updated) ?


this is what I did in my project

---- ADDED phone library


---- EDIT manifest

in manifest:
AddManifestText(
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="33"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.LightTheme)
AddPermission(android.permission.SEND_SMS)           '<--------------- ADDED Allows an application to send SMS messages.

---- CODE

code:
private Sub btninvia_Click

    Dim ps As PhoneSms

    ps.Send2("123456789", "Hi, message", False, False)

End Sub



---- run in debug mode on my android, version 9

---- I get this error

java.lang.SecurityException: Sending SMS message: uid 10305 does not have android.permission.SEND_SMS.


...oh yes, I read that google doesn't allow the android.permission.SEND_SMS anymore, but I read ONLY if the app is in google store.
My app is NOT in google store, it's only a test, run locally

so, the november 2023, how can I send an SMS?

(not an intent, a real send)

Thank you!
 
Last edited:

mcqueccu

Well-Known Member
Licensed User
Longtime User
Use Code Tags to post your codes

1700758395318.png
 
Upvote 0
Top