How to use SmsManager.importMultimediaMessage()? How to import MMS in Android's database?

272 views Asked by At

So, I'm building an app to copy all my messages (AND mms, WITH attachments) from iOS (iTunes backup) to Android Pie (OxygenOS).

I went through Android's SmsManager.java file, and I noticed two methods:

  • importTextMessage(...) does the job perfectly for SMS!!
  • importMultimediaMessage(...), hum.. MMS is a big deal.

Can someone explain me how to use importMultimediaMessage?
What are the first 2 params?

I wish I could just import the attachments (byte[]) and somehow, link it to a message..


PS: These 2 methods are part of internal APIs, and thus, they are not well documented.
To use it in a project, we have to:


PS2: For those wondering why I'm using internal APIs, I will not publish this app. It's just for personal purposes. I'll probably delete it after all my Message restored. That's why I feel free to use Android's internal APIs.


PS3: I also tried this accepted answer (stackoverflow.com/a/15224716/2559851), but I don't know why, the res variable is always null here

Uri res = context.getContentResolver().insert(partUri, mmsPartValue);
1

There are 1 answers

0
David On BEST ANSWER

Answering myself, I end up not using importMultimediaMessage().

If you want a working project, see here https://github.com/let-aurn/iosmessagetoandroid.