Android Question SMS permission

edgar_ortiz

Active Member
Licensed User
Longtime User
Hi,

I'm trying to send a sms:

B4X:
Sub EnviaSMS (ParNumero As String, ParMensaje As String)
    '
    Dim lcSMS As JavaObject
    Dim lcPort As Short = 90
    Dim lcDestination As String = ParNumero
    Dim Data() As Byte = ParMensaje.GetBytes("UTF8")
    '
    lcSMS = lcSMS.InitializeStatic("android.telephony.SmsManager").RunMethod("getDefault", Null)
    lcSMS.RunMethod("sendDataMessage", Array(lcDestination, "", lcPort, Data, Null, Null))
    '
End Sub

And I receive the error:

"Caused by: java.lang.SecurityException: Sending SMS message: User 10093 does not have android.permission.SEND_SMS."



Thanks in advance for your time,

Edgar
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…