Android Question SMS permission

Discussion in 'Android Questions' started by edgar_ortiz, Mar 8, 2015.

  1. edgar_ortiz

    edgar_ortiz Active Member Licensed User

    Hi,

    I'm trying to send a sms:

    Code:
    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, NullNull))
        
    '
    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
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Add this line to the manifest editor:
    Code:
    AddPermission(android.permission.SEND_SMS)
     
    edgar_ortiz likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice