Android Question How can I Keep as sms sent with send or send2

Gerrard

Member
Licensed User
Longtime User
I am able to capture an sms received using SI_MessageReceived and it goes into the normal list of messages received.
When I send an sms using send or send2 the sms is sent correctly and received correctly. But there is no record of the sent sms in my messages. How can I keep a copy of the sent sms?
 

DonManfred

Expert
Licensed User
Longtime User
your app needs to be the default-sms app in your system then it has the permission to write to the log too.
Only the default-sms app has write permissions to the log.
As i never wrote such an sms app i dont kno how it should work if you have the permission.

Search the forum for AddPermission to find a complete list of all permissions. Maybe there is one you need to add to your manifest to realize it.
 
Upvote 0

hzytsoft

Member
Licensed User
Longtime User
hi guy
U can add log by this code

Sub Addsms(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"), _
Array As String("java.lang.String")), _
ContentValues), Array As String("android.net.Uri", "android.content.ContentValues"))
End Sub
 
Upvote 0

Gerrard

Member
Licensed User
Longtime User
hi guy
U can add log by this code

Sub Addsms(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"), _
Array As String("java.lang.String")), _
ContentValues), Array As String("android.net.Uri", "android.content.ContentValues"))
End Sub
Thank you Hzytsoft
I tried your Addsms sub and it works really well.
I had looked all over for something like this.
Thanks again
Gerrard
 
Upvote 0
Top