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:
- use a modified version of android.jar (see version 28 here github.com/anggrayudi/android-hidden-api)
Run the following command from the computer
adb shell settings put global hidden_api_policy_pre_p_apps 1 adb shell settings put global hidden_api_policy_p_apps 1
according to developer.android.com/about/versions/pie/restrictions-non-sdk-interfaces
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);
Answering myself, I end up not using
importMultimediaMessage()
.If you want a working project, see here https://github.com/let-aurn/iosmessagetoandroid.