Send MMS from My application in android

后端 未结 2 1799
一个人的身影
一个人的身影 2021-02-05 09:19

I want to send MMS from my application to a specific number. I\'ve searched and found this code but I have no idea if this code what I need or not. My Questions is :

-c

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-05 09:25

    I found a link in an other thread to a github project that works 100% https://github.com/klinker41/android-smsmms

    Notice, that obligatory settings are only

    Settings sendSettings = new Settings();
    
    sendSettings.setMmsc(mmsc);
    sendSettings.setProxy(proxy);
    sendSettings.setPort(port);
    

    you can get them something like (found at Set APN programmatically on Android - answear by vincent091):

    Cursor cursor = null;
    if (Utils.hasICS()){
        cursor =SqliteWrapper.query(activity, activity.getContentResolver(), 
                Uri.withAppendedPath(Carriers.CONTENT_URI, "current"), APN_PROJECTION, null, null, null);
    } else {
        cursor = activity.getContentResolver().query(Uri.withAppendedPath(Telephony.Carriers.CONTENT_URI, "current"),
            null, null, null, null);
    }
    
    cursor.moveToLast();
    String type = cursor.getString(cursor.getColumnIndex(Telephony.Carriers.TYPE));
    String mmsc = cursor.getString(cursor.getColumnIndex(Telephony.Carriers.MMSC));
    String proxy = cursor.getString(cursor.getColumnIndex(Telephony.Carriers.MMSPROXY));
    String port = cursor.getString(cursor.getColumnIndex(Telephony.Carriers.MMSPORT));
    

提交回复
热议问题