5

I'm trying to write an app that send an MMS without user interaction (i.e. not using the ACTION_SEND intent), following what suggested here.

The statement

     HttpUtils.httpConnection(context, 4444L, MMSCenterUrl,
        bytesToSendFromPDU, HttpUtils.HTTP_POST_METHOD, !TextUtils
                .isEmpty(MMSProxy), MMSProxy, port);

return me an error that say that the statement cannot run in the same thread. So, I build a separate thread using the AsyncTask class and the doInBackground method.

Now, I'm receiving the following error

02-14 17:49:27.519: WARN/System.err(1884): java.io.IOException: Connect to /213.230.130.89:80 timed out 02-14 17:49:27.649: WARN/System.err(1884): Caused by: org.apache.http.conn.ConnectTimeoutException: Connect to /213.230.130.89:80 timed out

where 213.230.130.89 is my MMSProxy (the MMSCenterUrl is "http://mms.tim.it/servlets/mms").

pls consider that I'm able to send an MMS from the user interface with the same settings.

does anyone have any idea on what I'm missing?

thanks in advance.

[edit] I found the mistake. according to D. Kołakowski: "If you get result with Phone.APN_REQUEST_STARTED value, you have to wait for proper state. Register BroadCastReciver and wait until Phone.APN_ALREADY_ACTIVE appears". So I did a receiver for checking the phone connectivity status and, only then, perform the http-post request. Now it's working.

Community
  • 1
  • 1
gfoed
  • 51
  • 2
  • 6
  • 3
    If you found the mistake, then please add an answer and accept it, so this question doesn't linger around in the "unanswered" section. – EboMike Sep 22 '11 at 21:58
  • Check out [this tutorial](http://mobiforge.com/developing/story/sms-messaging-android) – Kyle Clegg Apr 05 '12 at 19:29
  • The following link can help you. http://androidbridge.blogspot.in/2011/03/how-to-send-mms-programmatically-in.html – Harsh Joshi Apr 07 '12 at 12:05
  • I am doing something similar HERE!!! http://stackoverflow.com/questions/21748209/receive-mms-messages-in-android-kitkat – Etienne Lawlor Feb 17 '14 at 07:34

0 Answers0