无法发送彩信?

时间:2017-11-23 05:40:47

标签: java android xml algorithm mms

过去两天,我一直在努力通过彩信发送图像文件。疯狂的是,没有崩溃!

此代码在我的服务中:

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();
    }

由于Android本身并不提供任何用于MMS的API,因此我使用Klinker api发送彩信。但是,我很乐意探索发送彩信的其他方式 - 我只是想发送这个图像文件!

请让我知道你看错了什么,或者我是否应该以不同的方式解决这个问题。

0 个答案:

没有答案