Sending mms in android 4.4

后端 未结 3 980
既然无缘
既然无缘 2020-12-21 20:30

I\'m trying to send mms from my app only. I made it default messaging app with help of android developers tutorial (http://android-developers.blogspot.com/2013/10/getting-yo

相关标签:
3条回答
  • 2020-12-21 21:05

    Easiest way i found for sending mms is android-smsmms library found here: https://github.com/klinker41/android-smsmms

    For gettings mmsc, proxy and port i used:

     final Cursor apnCursor = SqliteWrapper.query(mContext, this.mContext.getContentResolver(),
                    Uri.withAppendedPath(Telephony.Carriers.CONTENT_URI, "current"), APN_PROJECTION, null, null, null);
            String type = null;
            if (apnCursor.moveToFirst()) {
                do {
                    type = apnCursor.getString(3);
                    if(type.equals("default,supl,mms") ||
                            type.equals("mms")) {
                        mmsc = apnCursor.getString(0);
                        proxy = apnCursor.getString(1);
                        port = apnCursor.getString(2);
    }while (apnCursor.moveToNext());
    

    In if loop i am checking if APN has MMS data that i need otherwise go to next one.

    0 讨论(0)
  • 2020-12-21 21:20

    I believe the issue is that you are trying to send both image and text data, but your type is set to image. Try switching this instead to:

    mmsIntent.setType("*/*");
    
    0 讨论(0)
  • 2020-12-21 21:25

    As the default app, yours is responsible for sending the MMS itself, not opening another app to do so, which is what your code is doing. Currently, Android does not have a simple API for MMS, as it does for SMS. Furthermore, it is a very poorly documented aspect of the framework, and the amount of code and explanation necessary to implement it is out of scope for Stack Overflow. You're welcome to inspect the source code of the native app for guidance, but keep in mind that it is no trivial task, as the default app is responsible for everything needed to handle MMS, including sending, receiving, and Content Provider transactions.

    0 讨论(0)
提交回复
热议问题