开发者

how to send an MMS programmatically? [closed]

开发者 https://www.devze.com 2023-02-10 05:14 出处:网络
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time,or an extraordinarily narrow situation that is not generally applic
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 10 years ago.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号