Android Question RESOLVED ... Manually Add Incoming SMS to Message Logs

mangojack

Expert
Licensed User
Longtime User
I am Intercepting incoming SMS messages.This code works to add an Outgoing sms to the message logs,
but how can I manually write an incomming message ?
I have tried altering the code without success.
B4X:
Sub AddMessageToLogs(body As String, address As String)
 
  Dim r As Reflector
  r.Target = r.CreateObject("android.content.ContentValues")
  r.RunMethod3("put", "address", "java.lang.String", address, "java.lang.String")
  r.RunMethod3("put", "body", "java.lang.String", body, "java.lang.String")
  Dim ContentValues As Object = r.Target
  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"), _  ' @@@ tried sms/receive , received
  Array As String("java.lang.String")), _
  ContentValues), Array As String("android.net.Uri", "android.content.ContentValues"))
     
End Sub
Regards
 

mangojack

Expert
Licensed User
Longtime User
by altering this line to ' //sms/inbox ' the incomming message is written to to messages log.

B4X:
r.RunStaticMethod("android.net.Uri", "parse", Array As Object("content://sms/inbox"), _
 
Upvote 0
Top