add handling for storing sent messages

This commit is contained in:
tibbi 2020-04-05 19:12:02 +02:00
parent 420a88c74c
commit e1f1583b17
6 changed files with 59 additions and 8 deletions

View file

@ -162,16 +162,16 @@ fun Context.getNameFromPhoneNumber(number: String): Int? {
return null
}
fun Context.insertNewSMS(address: String, subject: String, body: String, date: Long, threadId: Long) {
fun Context.insertNewSMS(address: String, subject: String, body: String, date: Long, read: Int, threadId: Long, type: Int) {
val uri = Telephony.Sms.CONTENT_URI
val contentValues = ContentValues().apply {
put(Telephony.Sms.ADDRESS, address)
put(Telephony.Sms.SUBJECT, subject)
put(Telephony.Sms.BODY, body)
put(Telephony.Sms.DATE, date)
put(Telephony.Sms.READ, 0)
put(Telephony.Sms.READ, read)
put(Telephony.Sms.THREAD_ID, threadId)
put(Telephony.Sms.TYPE, Telephony.Sms.MESSAGE_TYPE_INBOX)
put(Telephony.Sms.TYPE, type)
}
contentResolver.insert(uri, contentValues)