In this post:
https://www.b4x.com/android/forum/threads/log-or-write-sms-message-send-to-phone.10287/#post-102749
Erel shows code to "add a message to the phone logs" and the thread is in the vein of adding messages so the native message app can see them.
I've put this in a little test app but I can't get any obvious result when I run it - no errors either.
Am I fundamentally missing the point? where should the messages appear?
Also the post is circa 2012 so is the code still relevant?
I attach the body of Erel's post below for ease of reference:
You can use this code to add a message to the phone logs:
This code requires reflection library.
You should add this manifest editor code:
Any help or pointers appreciated...
https://www.b4x.com/android/forum/threads/log-or-write-sms-message-send-to-phone.10287/#post-102749
Erel shows code to "add a message to the phone logs" and the thread is in the vein of adding messages so the native message app can see them.
I've put this in a little test app but I can't get any obvious result when I run it - no errors either.
Am I fundamentally missing the point? where should the messages appear?
Also the post is circa 2012 so is the code still relevant?
I attach the body of Erel's post below for ease of reference:
You can use this code to add a message to the phone logs:
B4X:
Sub AddSentSms(Address As String, Body As String)
Dim r As Reflector
Dim values As Object
values = r.CreateObject("android.content.ContentValues")
r.Target = values
Dim s As String
s = "java.lang.String"
r.RunMethod4("put", Array As Object("type", 2), Array As String(s, "java.lang.Integer"))
r.RunMethod3("put", "address", s, Address, s)
r.RunMethod3("put", "body", s, Body, s)
r.Target = r.GetContext
r.Target = r.RunMethod("getContentResolver")
r.RunMethod4("insert", _
Array As Object(r.RunStaticMethod("android.net.Uri", "parse", _
Array As Object("content://sms/sent"), Array As String(s)), values), _
Array As String("android.net.Uri", "android.content.ContentValues"))
End Sub
This code requires reflection library.
You should add this manifest editor code:
B4X:
AddPermission("android.permission.WRITE_SMS")
AddPermission("android.permission.READ_SMS")
Any help or pointers appreciated...