Improve SMS delivery report handling

On some phones, SMS message is marked delivered even though it wasn't really delivered, this should fix such issues. Based on AOSP and Signal app
This commit is contained in:
Naveen 2023-01-05 23:51:29 +05:30
parent f24001ea3d
commit 08ee7ac700
3 changed files with 69 additions and 60 deletions

View file

@ -3,9 +3,11 @@ package com.simplemobiletools.smsmessenger.messaging
import android.app.Activity
import android.content.ContentValues
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.provider.Telephony.Sms
import android.telephony.SmsManager
import android.telephony.SmsMessage
import android.widget.Toast
import com.klinker.android.send_message.Message
import com.klinker.android.send_message.Settings
@ -88,6 +90,12 @@ class MessagingUtils(val context: Context) {
}
}
fun getSmsMessageFromDeliveryReport(intent: Intent): SmsMessage? {
val pdu = intent.getByteArrayExtra("pdu")
val format = intent.getStringExtra("format")
return SmsMessage.createFromPdu(pdu, format)
}
@Deprecated("TODO: Move/rewrite MMS code into the app.")
fun sendMmsMessage(text: String, addresses: List<String>, attachments: List<Attachment>, settings: Settings) {
val transaction = Transaction(context, settings)