how to send an MMS programmatically? [closed]
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.
精彩评论