Android Question android 6.0 send sms permission

ronell

Well-Known Member
Licensed User
Longtime User
this error raise when i send sms using android version 6.0 and up, already added the permission in manifest AddPermission(android.permission.SEND_SMS)
java.lang.SecurityException: Sending SMS message: uid 10197 does not have android.permission.SEND_SMS.
at android.os.Parcel.readException(Parcel.java:1599)
at android.os.Parcel.readException(Parcel.java:1552)
at com.android.internal.telephony.ISms$Stub$Proxy.sendTextForSubscriber(ISms.java:1190)
at android.telephony.SmsManager.sendTextMessageInternal(SmsManager.java:362)
at android.telephony.SmsManager.sendTextMessage(SmsManager.java:329)
at anywheresoftware.b4a.phone.Phone$PhoneSms.Send2(Phone.java:628)
at b4a.example.main._btnbutton_click(main.java:592)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:157)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:153)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:78)
at android.view.View.performClick(View.java:5272)
at android.view.View$PerformClick.run(View.java:21528)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5867)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1026)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:887)

code for sending sms
B4X:
    p.Send2("*********","sample",True,False)
 

Computersmith64

Well-Known Member
Licensed User
Longtime User
What is the targetSdkVersion set to in your manifest? If it's 23 & up, you will also need to use the Runtime Permissions to get the user to allow it.

- Colin.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Top