Can't send MMS?

I have been trying to send an image file via MMS in the last two days. Crazy thing, no glitches!

This code is in my service:

static Settings settings;
    public static void sendPicture(final byte [] data){
        final Bitmap bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
             new Thread(new Runnable() {
                 @Override
                 public void run() {

                ApnUtils.initDefaultApns(z, new ApnUtils.OnApnFinishedListener() { //Z is just an instance variable that stores context
                    @Override
                    public void onFinished() {
                        settings = Settings.get(z, true);
                    }
                });

                Settings settings = Settings.get(z); 
                com.klinker.android.send_message.Settings sendSettings = new com.klinker.android.send_message.Settings();
                sendSettings.setMmsc(settings.getMmsc());
                sendSettings.setProxy(settings.getMmsProxy());
                sendSettings.setPort(settings.getMmsPort());
                sendSettings.setUseSystemSending(true);
                Transaction transaction = new Transaction(z, sendSettings);
                Message message = new Message("This is my MMS!", "##########", bmp);
                transaction.sendNewMessage(message, Transaction.NO_THREAD_ID);

                Log.v("myTag", "Sent MMS!");

            }
        }).start();
    }

Since Android does not provide an API for MMS, I use the Klinker api to send MMS. However, I am more than happy to learn other ways to send MMS — I just want to send this image file!

Please let me know what you see wrong, or if I approach it differently.

0
source share

All Articles