-1

In my android application I want to send MMS from background service without user interaction, I tried to use SmsManager.sendMultimediaMessage but this method requires API-21 atleast and I am working on API-19 (Android KitKat). So please tell how can I send MMS from background service without user interaction in Android API level 19 (KitKat)?

Salu
  • 53
  • 7

1 Answers1

0

Use this page.

since i shouldn't answer with just a link. I copied some content from there.

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));
Community
  • 1
  • 1
Mehran Zamani
  • 831
  • 9
  • 31