Sending SMS question

IanMc

Well-Known Member
Licensed User
Longtime User
If I use Erel's rather fine code to send an SMS from my app:
B4X:
Sub SendSms(PhoneNumber As String, Text As String)
    ' if smssendallow = true then 'give the option to deny sms text sending in the settings.
   Try
       Dim ps As PhoneSms
       Dim r As Reflector
       r.Target = r.RunStaticMethod("android.telephony.SmsManager", "getDefault", Null, Null)
       r.RunMethod4("sendTextMessage", Array As Object(PhoneNumber, Null, Text, Null, Null), _
           Array As String("java.lang.String", "java.lang.String", "java.lang.String", _
               "android.app.PendingIntent", "android.app.PendingIntent"))
      ToastMessageShow("Sent SMS Text to " & PhoneNumber, False)            
   Catch
      Log("Failed to send SMS to " & PhoneNumber)
   End Try
End Sub
I get a popup that says something like 'Application (my app name) is requesting permission to send SMS messages. This is considered risky. Allow application permission?
Then there are two buttons, Allow and Deny and the Deny button has a countdown from 10 to zero in seconds.
There is also a radio button on the message that says 'don't ask'

If I check that radio button, how would I 'uncheck' it later?
:sign0163:
 

IanMc

Well-Known Member
Licensed User
Longtime User
I'm using a rather weird system :)

But I found an easy solution.

If you want the popup to come back again then just uninstall the app and re-install it :)
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
Think I've seen this message too but can't remember now the model.

Anyway, since it's a permission granted to your specific app, you could just save a boolean flag, allowing the particular action to be taken or not, without the need to reset the permission.
 
Upvote 0
Top