1. Are you ready for the Galaxy S20? Here is everything we know so far!

Simple Hello World for SMS Access without root?

Discussion in 'Android Development' started by Ajhalls, Feb 11, 2021.

  1. Ajhalls

    Ajhalls Lurker
    Thread Starter

    This is my first time working with Kotlin or Android. I looking to get a very basic Hello World type thing started as a proof of concept of a future app, but need a little basic guidance.

    I would like to be able to back up my SMS and my MMS messages. I have found that most applications focus on SMS only, which for me, leaves out many important messages.

    I am just looking for a basic proof of concept that I can connect to that database located in the `/data/data/com.android.providers.telephony/mmssms.db` without being root.

    I was able to, using a PC software BackupTrans, get a local copy of the db using USB debugging, and so I have all my queries written, but would like to know how to access that database, and for extra credit, it would be awesome if it isn't any extra effort to access the files at: `/data/user_de/0/com.android.providers.telephony/app_parts/` where the images and other multimedia files are at.

    So as a for instance, I normally work in C#, so forgive me, if I wanted to run this query, how would I do so?

    using (SqliteConnection DatabaseConnection = new SqliteConnection(string.Format(@"Data Source=D:\CodeStuff\MMS_Backup\part\mmssms.db")))
    SqliteCommand GetDataCommand =
    new SqliteCommand(@"SELECT * FROM(

    SELECT DISTINCT datetime(date, 'unixepoch','localtime') as msg_date , text as msg, cl as attachment , ""mms"" as type, msg_box as direction FROM part JOIN pdu ON pdu._id=part.mid
    WHERE pdu.thread_id =1011

    SELECT datetime(sms.date/1000, 'unixepoch','localtime') as msg_date ,body as msg, """" as attachment, ""sms"" as type, type as direction
    FROM sms
    WHERE sms.thread_id = 1011

    WHERE attachment !=""0.smil"" AND attachment !=""smil.xml""
    order by msg_date", DatabaseConnection);
    var dbResults = GetDataCommand.ExecuteReader();
    while (dbResults.Read()){

    I would like to stay away from rooting the phone because if this works, I would like to make it more accessible to more people, and nobody wants the chance of data loss just to back things up :)

    1. Download the Forums for Android™ app!



Share This Page