1

My brodcastreceiver successfully receives MMS, but I cannot download data from a URL GET request. When I get a request : IOException Time Out.

  public class MMSReceiver extends BroadcastReceiver {

Context context;
ConnectivityManager manager;

public void onReceive(final Context context, Intent intent) {
        this.context = context;
        Bundle bundle = intent.getExtras();
        manager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);

        byte[] buffer = bundle.getByteArray("data");
        GenericPdu genericPdu = new PduParser(buffer).parse();
        ContentValues vl = getParams(genericPdu);
        final String contentLocation = "http://mmscr:8002/0420000037936141022152222001";

        new Thread(new Runnable() {
                @Override
                public void run() {
                        try {
                                ensureRouteToHost(context, contentLocation ,  "10.10.10.10");
                                // THIS HTTP GET REQUEST \/\/\/\/\/\/
                                byte[] rawPdu = HttpUtils.httpConnection(context, SendingProgressTokenManager.NO_TOKEN,contentLocation , null, HttpUtils.HTTP_GET_METHOD, true, "10.10.10.10", 8080); 

                                Log.i("mLogs", "DATA :" + rawPdu.length);
                        } catch (IOException e) {
                                e.printStackTrace();
                        }
                }
        }).start();

}
Chekin
  • 11
  • 2

1 Answers1

0

Most operator MMS relay server reside in private networks which are inaccessible from public internet. You need to use a separate APN and sometimes HTTP proxy to access URLs containing MMS message body. Make sure that before call to ensureRouteToHost() you have connected up to correct APN and that you use HTTP proxy if one is needed for your operator.

Vjeko
  • 171
  • 1
  • 3