mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 19:38:52 +01:00
Replace google-mms with android-smsmms
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
package presentation.receiver
|
||||
|
||||
import android.net.Uri
|
||||
import com.klinker.android.send_message.MmsReceivedReceiver
|
||||
import timber.log.Timber
|
||||
|
||||
class MmsReceivedReceiver : MmsReceivedReceiver() {
|
||||
|
||||
override fun onMessageReceived(messageUri: Uri?) {
|
||||
super.onMessageReceived(messageUri)
|
||||
Timber.v("onMessageReceived: $messageUri")
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,56 +18,6 @@
|
||||
*/
|
||||
package presentation.receiver
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.provider.Telephony
|
||||
import com.google.android.mms.ContentType
|
||||
import com.google.android.mms.pdu_alt.GenericPdu
|
||||
import com.google.android.mms.pdu_alt.NotificationInd
|
||||
import com.google.android.mms.pdu_alt.PduHeaders
|
||||
import com.google.android.mms.pdu_alt.PduParser
|
||||
import timber.log.Timber
|
||||
import com.android.mms.transaction.PushReceiver
|
||||
|
||||
class MmsReceiver : BroadcastReceiver() {
|
||||
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
if (Telephony.Sms.Intents.WAP_PUSH_DELIVER_ACTION == intent.action && ContentType.MMS_MESSAGE == intent.type) {
|
||||
val data = intent.getByteArrayExtra("data")
|
||||
val parser = PduParser(data)
|
||||
var pdu: GenericPdu? = null
|
||||
|
||||
try {
|
||||
pdu = parser.parse()
|
||||
} catch (e: RuntimeException) {
|
||||
Timber.e("Invalid MMS WAP push", e)
|
||||
}
|
||||
|
||||
if (pdu == null) {
|
||||
Timber.e("Invalid WAP push data")
|
||||
return
|
||||
}
|
||||
|
||||
when (pdu.messageType) {
|
||||
PduHeaders.MESSAGE_TYPE_NOTIFICATION_IND -> {
|
||||
val notificationInd = pdu as NotificationInd
|
||||
val location = String(notificationInd.contentLocation)
|
||||
Timber.v("Received MMS notification: " + location)
|
||||
}
|
||||
|
||||
PduHeaders.MESSAGE_TYPE_DELIVERY_IND -> {
|
||||
Timber.v("Received delivery report")
|
||||
}
|
||||
|
||||
PduHeaders.MESSAGE_TYPE_READ_ORIG_IND -> {
|
||||
Timber.v("Received read report")
|
||||
}
|
||||
|
||||
else -> {
|
||||
Timber.v("Received unhandled MMS type: ${pdu.messageType}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
class MmsReceiver : PushReceiver()
|
||||
Reference in New Issue
Block a user