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

Discussion in 'Android Questions' started by Gerrard, May 18, 2015.

  1. Gerrard

    Gerrard Member Licensed 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?
  2. DonManfred

    DonManfred Expert Licensed 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.
  3. hzytsoft

    hzytsoft Member Licensed 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("", "parse", Array As Object("content://sms/sent"), _
    Array As String("java.lang.String")), _
    ContentValues), Array As String("", "android.content.ContentValues"))
    End Sub
    DonManfred likes this.
  4. Gerrard

    Gerrard Member Licensed User

    Thank you Hzytsoft
    I tried your Addsms sub and it works really well.
    I had looked all over for something like this.
    Thanks again