Hi,
I have a doubt.
1) I am unable to send SMS by using PhoneSMS.
I have attached a sample source code.
In the attached code, I tried the solution given earlier of sending sms via 'Intent' (the relevant lines are commented in that code with a 'X ).
Though that code worked fine, I had to explicitly press the 'Send' button on the Phone to send the SMS.
The solution given in the forum to this was that we should use the PhoneSMS library (and also since my app is not to be published under Google Play so .. those restrictions do not apply)..
The error message shown is below.
It is to inform that the program when started does not ask for any enabling of permissions - it simply hangs...
2) Assuming this is possible, can someone post an example of how to capture the 'SMS Sent', 'SMS Received' events etc..
Please help.
Thanks..
The Error message :
Logger connected to: Xiaomi Redmi Note 7 Pro
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
main_activity_create (java line: 352)
java.lang.SecurityException: Sending SMS message: uid 10239 does not have android.permission.SEND_SMS.
at android.os.Parcel.createException(Parcel.java:1953)
at android.os.Parcel.readException(Parcel.java:1921)
at android.os.Parcel.readException(Parcel.java:1871)
at com.android.internal.telephony.ISms$Stub$Proxy.sendTextForSubscriber(ISms.java:871)
at android.telephony.SmsManager.sendTextMessageInternal(SmsManager.java:342)
at android.telephony.SmsManager.sendTextMessage(SmsManager.java:325)
at anywheresoftware.b4a.phone.Phone$PhoneSms.Send2(Phone.java:644)
at anywheresoftware.b4a.phone.Phone$PhoneSms.Send(Phone.java:626)
at b4a.example.main._activity_create(main.java:352)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at b4a.example.main.afterFirstLayout(main.java:105)
at b4a.example.main.access$000(main.java:17)
at b4a.example.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6823)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
I have a doubt.
1) I am unable to send SMS by using PhoneSMS.
I have attached a sample source code.
In the attached code, I tried the solution given earlier of sending sms via 'Intent' (the relevant lines are commented in that code with a 'X ).
Though that code worked fine, I had to explicitly press the 'Send' button on the Phone to send the SMS.
The solution given in the forum to this was that we should use the PhoneSMS library (and also since my app is not to be published under Google Play so .. those restrictions do not apply)..
The error message shown is below.
It is to inform that the program when started does not ask for any enabling of permissions - it simply hangs...
2) Assuming this is possible, can someone post an example of how to capture the 'SMS Sent', 'SMS Received' events etc..
Please help.
Thanks..
The Error message :
Logger connected to: Xiaomi Redmi Note 7 Pro
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
main_activity_create (java line: 352)
java.lang.SecurityException: Sending SMS message: uid 10239 does not have android.permission.SEND_SMS.
at android.os.Parcel.createException(Parcel.java:1953)
at android.os.Parcel.readException(Parcel.java:1921)
at android.os.Parcel.readException(Parcel.java:1871)
at com.android.internal.telephony.ISms$Stub$Proxy.sendTextForSubscriber(ISms.java:871)
at android.telephony.SmsManager.sendTextMessageInternal(SmsManager.java:342)
at android.telephony.SmsManager.sendTextMessage(SmsManager.java:325)
at anywheresoftware.b4a.phone.Phone$PhoneSms.Send2(Phone.java:644)
at anywheresoftware.b4a.phone.Phone$PhoneSms.Send(Phone.java:626)
at b4a.example.main._activity_create(main.java:352)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:213)
at b4a.example.main.afterFirstLayout(main.java:105)
at b4a.example.main.access$000(main.java:17)
at b4a.example.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:201)
at android.app.ActivityThread.main(ActivityThread.java:6823)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)