Back to project page MMSUtility.
The source code is released under:
Apache License
If you think the Android project MMSUtility listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.sreid.mmsutility; /* w w w .j a v a2 s. c o m*/ import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.widget.Toast; import com.klinker.android.send_message.Message; import com.klinker.android.send_message.Settings; import com.klinker.android.send_message.Transaction; /** * Created by sean on 9/21/14. * this class will be a singleton that will be able to send text as an MMS to a specified recipient. * this will be implemented after I have done more reading on the API to do it. */ public class MMSUtility { /** * Sends an MMS with a subject * @param message -> the message to be sent * @param number -> the phone number of the recipient * @param subject -> the subject of the MMS * @param appContext -> the return of getApplicationContext() from the Activity * @return -> boolean to show whether sending of message was possible */ public static void sendAsMMS(String message, String number, String subject, Context appContext, String APN, String Proxy, String Port) { Settings settings = new Settings(); settings.setMmsc(APN); settings.setProxy(Proxy); settings.setPort(Port); settings.setGroup(false); settings.setDeliveryReports(false); settings.setSplit(false); settings.setSplitCounter(false); settings.setStripUnicode(false); settings.setSignature(""); settings.setSendLongAsMms(true); settings.setSendLongAsMmsAfter(1); settings.setAccount(""); settings.setRnrSe(null); Transaction sendTransaction = new Transaction(appContext, settings); Message mMessage = new Message(message, number); mMessage.setSubject(subject); mMessage.setType(Message.TYPE_SMSMMS); sendTransaction.sendNewMessage(mMessage, android.os.Process.getThreadPriority(android.os.Process.myTid())); Toast.makeText(appContext, "MMS Sent!", Toast.LENGTH_LONG).show(); } /** * Sends an MMS without a subject * @param message -> the message to be sent * @param number -> the phone number of the recipient * @param appContext -> the return of getApplicationContext() from the Activity * @return -> boolean to show whether sending of message was possible */ public static void sendAsMMS(String message, String number, Context appContext, String APN, String Proxy, String Port) { Settings settings = new Settings(); settings.setMmsc(APN); settings.setProxy(Proxy); settings.setPort(Port); settings.setGroup(false); settings.setDeliveryReports(false); settings.setSplit(false); settings.setSplitCounter(false); settings.setStripUnicode(false); settings.setSignature(""); settings.setSendLongAsMms(true); settings.setSendLongAsMmsAfter(1); settings.setAccount(""); settings.setRnrSe(null); Transaction sendTransaction = new Transaction(appContext, settings); Message mMessage = new Message(message, number); mMessage.setSubject("<No Subject>"); mMessage.setType(Message.TYPE_SMSMMS); sendTransaction.sendNewMessage(mMessage, android.os.Process.getThreadPriority(android.os.Process.myTid())); Toast.makeText(appContext, "MMS Sent!", Toast.LENGTH_LONG).show(); } }