Невозможно отправить MMS с помощью Android 2.3.4, но с 2.2.2 все в порядке. Проблема с данными MOBILE_MMS и MOBILE, активными вместе?
Я создал приложение для Android, которое отправляет MMS в ответ на получение SMS. Приложение работает хорошо - на LG Optimus ME под управлением Android 2.2.2. Тем не менее, приложение не может отправить MMS при работе на Samsung Galaxy S 2 под управлением Android 2.3.4. Сбой происходит в тот момент, когда приложение пытается открыть выходной поток на сервер MMS оператора мобильной связи через прокси-сервер (как определено в соответствующем APN). Это просто время ожидания.
Я записал логи приложения, работающего на двух устройствах, и единственное существенное отличие состоит в том, что на LG Optimus ME, когда я включаю MMS, звоня ConnectivityManager.startUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE, "enableMMS")
, МОБИЛЬНАЯ сетевая служба автоматически отключается. На Samsung Galaxy S 2 услуга мобильной сети остается подключенной. Я использую ConnectivityManager.requestRouteToHost()
чтобы убедиться, что прокси-сервер APN является контактным.
Вот сообщения журнала. Мне жаль, что они такие длинные, но, надеюсь, кто-то сможет объяснить, почему не удается подключиться к прокси-серверу APN на Samsung, но на LG. Я предполагаю, что это потому, что мобильное соединение для передачи данных не отключается, как это происходит в LG. Другим интересным моментом является причина, приведенная для CONNECTIVTY_CHANGE
на LG apnSwitched, а на Samsung - apnEnabled.
11-25 10:57:10.599: I/ck.android.util.msg.mms.MmsConnectivityManager(2786): Obtaining connectivity manager
11-25 10:57:10.599: I/ck.android.util.msg.mms.MmsConnectivityManager(2786): Registering receiver
**11-25 10:57:10.609: I/ck.android.util.msg.mms.MmsConnectivityManager(2786): Attempting to use MMS network feature**
11-25 10:57:10.619: I/ck.android.util.msg.mms.MmsConnectivityManager(2786): Now starting watchdog, which will wait for 60000 milliseconds
11-25 10:57:10.629: I/ck.android.util.msg.mms.MmsConnectivityManager$1(2786): Watchdog has started
11-25 10:57:10.629: I/ck.android.util.msg.mms.MmsConnectivityManager$MyConnectivityReceiver(2786): onReceive(): Intent action is android.net.conn.CONNECTIVITY_CHANGE
11-25 10:57:10.629: I/ck.android.util.msg.mms.MmsConnectivityManager$MyConnectivityReceiver(2786): No Conectivity Status: false, Reason :apnSwitched, FailOver :true, Current Network Info : NetworkInfo: type: **mobile[UMTS], state: CONNECTED/CONNECTED, reason: apnSwitched**, extra: www.vodafone.net.nz, roaming: false, failover: false, isAvailable: true, OtherNetwork Info :null
11-25 10:57:10.639: I/ck.android.util.msg.mms.MmsConnectivityManager$MyConnectivityReceiver(2786): **Current network type is mobile**
11-25 10:57:10.639: I/ck.android.util.msg.mms.MmsConnectivityManager$MyConnectivityReceiver(2786): Connection status: **true**
11-25 10:57:10.759: I/ck.android.spycam.CameraPreview(2786): surfaceCreated()
11-25 10:57:10.759: I/ck.android.spycam.CameraPreview(2786): surfaceCreated() has finished
11-25 10:57:10.759: I/ck.android.spycam.act.PictureTaker$1(2786): CameraPreviewCallback: Surface created
11-25 10:57:10.769: I/ck.android.spycam.CameraPreview(2786): Surface changed: We ignore this
11-25 10:57:10.769: I/ck.android.spycam.act.PictureTaker$1(2786): CameraPreviewCallback: Surface change completed
11-25 10:57:11.299: I/ck.android.util.msg.mms.MmsConnectivityManager$MyConnectivityReceiver(2786): onReceive(): Intent action is android.net.conn.CONNECTIVITY_CHANGE
11-25 10:57:11.299: I/ck.android.util.msg.mms.MmsConnectivityManager$MyConnectivityReceiver(2786): No Conectivity Status: true, Reason :apnSwitched, FailOver :false, Current Network Info : **NetworkInfo: type: mobile[UMTS], state: DISCONNECTED/DISCONNECTED, reason: apnSwitched**, extra: www.vodafone.net.nz, roaming: false, failover: false, isAvailable: false, OtherNetwork Info :null
11-25 10:57:11.309: I/ck.android.util.msg.mms.MmsConnectivityManager$MyConnectivityReceiver(2786): Current network type is **mobile**
11-25 10:57:11.309: I/ck.android.util.msg.mms.MmsConnectivityManager$MyConnectivityReceiver(2786): Connection status: **false**
11-25 10:57:16.499: I/ck.android.util.msg.mms.MmsConnectivityManager$MyConnectivityReceiver(2786): onReceive(): Intent action is android.net.conn.CONNECTIVITY_CHANGE
11-25 10:57:16.499: I/ck.android.util.msg.mms.MmsConnectivityManager$MyConnectivityReceiver(2786): No Conectivity Status: false, Reason :apnSwitched, FailOver :false, Current Network Info : **NetworkInfo: type: mobile_mms[HSDPA], state: CONNECTED/CONNECTED, reason: apnSwitched**, extra: live.vodafone.com, roaming: false, failover: false, isAvailable: true, OtherNetwork Info :null
11-25 10:57:16.499: I/ck.android.util.msg.mms.MmsConnectivityManager$MyConnectivityReceiver(2786): Current network type is **mobile_mms**
11-25 10:57:16.499: I/ck.android.util.msg.mms.MmsConnectivityManager$MyConnectivityReceiver(2786): Connection status: **true**
11-25 10:57:16.499: I/ck.android.util.msg.mms.MmsConnectivityManager$MyConnectivityReceiver(2786): MMS connectivity established
11-25 10:57:16.499: I/ck.android.util.msg.mms.MmsConnectivityManager$MyConnectivityReceiver(2786): Watchdog is alive, so interrupting
11-25 10:57:16.519: I/ck.android.util.msg.mms.MmsConnectivityManager$1(2786): Watchdog interrupted. Assuming we are now connected
11-25 10:57:16.539: I/ck.android.util.msg.mms.MmsConnectivityManager(2786): Checking MMS connectivity state
11-25 10:57:16.539: I/ck.android.util.msg.mms.MmsConnectivityManager(2786): We are now connected. Now setting network preference to TYPE_MOBILE_MMS
11-25 10:57:16.549: I/ck.android.util.msg.mms.MmsConnectivityManager(2786): Firing mmsConnectivityEnabled
11-25 10:57:16.549: I/ck.android.spycam.act.PictureTaker$2(2786): MMS connectivity established. Taking picture ...
11-25 10:57:16.549: I/ck.android.spycam.act.PictureTaker$2(2786): Debug: check connectivity to Vodafone NZ MMS proxy. Address is -1407310333
11-25 10:57:16.549: I/ck.android.spycam.act.PictureTaker$2(2786): MMS: true
11-25 10:57:16.549: I/ck.android.spycam.act.PictureTaker(2786): Taking picture ...
11-25 10:57:17.002: I/ck.android.spycam.act.PictureTaker$4(2786): Shutter callback
11-25 10:57:17.299: I/ck.android.spycam.act.PictureTaker$5(2786): Raw picture callback.
11-25 10:57:17.299: W/ck.android.spycam.act.PictureTaker$5(2786): Picture data is null.
11-25 10:57:17.329: I/ck.android.spycam.act.PictureTaker$6(2786): Jpeg picture taken. 2424 bytes
11-25 10:57:17.339: I/ck.android.spycam.act.PictureTaker$6(2786): Sending PXT to +6421XXXXXX
11-25 10:57:17.339: I/ck.android.util.msg.MsgUtil(2786): Sending JPEG via MMS to +6421XXXXXX
11-25 10:57:17.339: I/ck.android.util.msg.MsgUtil(2786): Adding content to message
11-25 10:57:17.349: I/ck.android.util.msg.MsgUtil(2786): Message encoded
11-25 10:57:17.359: I/ck.android.util.msg.MsgUtil(2786): Getting list of APNs
11-25 10:57:17.369: I/ck.android.util.msg.MsgUtil(2786): Using APN: MMS Center URL: http://pxt.vodafone.net.nz/pxtsend, MMS Port: 8080, MMS Proxy: 172.030.038.003
11-25 10:57:17.369: I/ck.android.util.msg.MsgUtil(2786): [MMSCenter]http://pxt.vodafone.net.nz/pxtsend, [MMSProxy]172.030.038.003, [MMSPort]8080
11-25 10:57:17.369: I/ck.android.util.msg.mms.nokia.MMSender(2786): Sending...
11-25 10:57:17.369: I/ck.android.util.msg.mms.nokia.MMSender(2786): MMS URL is http://pxt.vodafone.net.nz/pxtsend
11-25 10:57:17.369: I/ck.android.util.msg.mms.nokia.MMSender(2786): Setting proxy to: 172.030.038.003:8080
11-25 10:57:17.379: I/ck.android.util.msg.mms.nokia.MMSender(2786): Proxy: HTTP//172.30.38.3:8080
11-25 10:57:17.379: I/ck.android.util.msg.mms.nokia.MMSender(2786): Creating decoder
11-25 10:57:17.379: I/ck.android.util.msg.mms.nokia.MMSender(2786): Decoding header
11-25 10:57:17.379: I/ck.android.util.msg.mms.nokia.MMSender(2786): Getting message
11-25 10:57:17.379: I/ck.android.util.msg.mms.nokia.MMSender(2786): Opening connection
11-25 10:57:17.389: I/ck.android.util.msg.mms.nokia.MMSender(2786): Connection opened. Using proxy: true. Setting doOutput
11-25 10:57:17.389: I/ck.android.util.msg.mms.nokia.MMSender(2786): Connection timeout is 0. Adding 60 seconds
11-25 10:57:17.389: I/ck.android.util.msg.mms.nokia.MMSender(2786): Connection timeout is now 60000
11-25 10:57:17.389: I/ck.android.util.msg.mms.nokia.MMSender(2786): Reading header
11-25 10:57:17.389: I/ck.android.util.msg.mms.nokia.MMSender(2786): [X-NOKIA-MMSC-Charging]100
11-25 10:57:17.389: I/ck.android.util.msg.mms.nokia.MMSender(2786): Setting request properties
11-25 10:57:17.389: I/ck.android.util.msg.mms.nokia.MMSender(2786): Getting output stream
11-25 10:57:22.729: I/ck.android.util.msg.mms.nokia.MMSender(2786): **Writing data to output stream. 2531 bytes**
11-25 10:57:22.729: I/ck.android.util.msg.mms.nokia.MMSender(2786): Finished writing to output stream. About to close it ...
11-25 10:57:22.729: I/ck.android.util.msg.mms.nokia.MMSender(2786): Need to close output stream
11-25 10:57:22.729: I/ck.android.util.msg.mms.nokia.MMSender(2786): Now waiting for response. Getting response code
11-25 10:57:24.849: I/ck.android.util.msg.mms.nokia.MMSender(2786): Reading response
11-25 10:57:25.039: I/ck.android.util.msg.mms.nokia.MMSender(2786): Getting response headers
11-25 10:57:25.039: I/ck.android.util.msg.mms.nokia.MMSender(2786): Closing output stream
11-25 10:57:25.039: I/ck.android.util.msg.mms.nokia.MMSender(2786): Closing input stream
11-25 10:57:25.049: I/ck.android.util.msg.mms.nokia.MMSender(2786): Closing connection
11-25 10:57:25.049: I/ck.android.util.msg.mms.nokia.MMSender(2786): Closing connection and finishing
11-25 10:57:25.049: I/ck.android.util.msg.MsgUtil(2786): Message sent to http://pxt.vodafone.net.nz/pxtsend
11-25 10:57:25.059: I/ck.android.util.msg.MsgUtil(2786): **Response code: 200 OK**
11-25 10:57:25.059: I/ck.android.util.msg.MsgUtil(2786): DATE: Thu, 24 Nov 2011 21:57:28 GMT
11-25 10:57:25.059: I/ck.android.util.msg.MsgUtil(2786): CONTENT-TYPE: application/vnd.wap.mms-message
11-25 10:57:25.059: I/ck.android.util.msg.MsgUtil(2786): CONTENT-LENGTH: 33
11-25 10:57:25.069: I/ck.android.util.msg.MsgUtil(2786): ACCEPT-RANGES: bytes
11-25 10:57:25.069: I/ck.android.util.msg.MsgUtil(2786): SERVER: XMS (724Solutions HTA XMA_40_M0_B093 20090820.094517)
11-25 10:57:25.069: I/ck.android.util.msg.MsgUtil(2786): **MMS sent to +6421XXXXXX successfully**
Samsung Galaxy S 2 (Android 2.3.4)
11-25 10:59:09.070: 11-25 10:59:09.070: I/ck.android.util.msg.mms.deprecated.MmsConnectivityManager(4986): Obtaining connectivity manager
11-25 10:59:09.070: I/ck.android.util.msg.mms.deprecated.MmsConnectivityManager(4986): Registering receiver
11-25 10:59:09.070: I/ck.android.util.msg.mms.deprecated.MmsConnectivityManager(4986): Attempting to use MMS network feature
11-25 10:59:09.075: I/ck.android.util.msg.mms.deprecated.MmsConnectivityManager(4986): Now starting watchdog, which will wait for 60000 milliseconds
11-25 10:59:09.080: I/ck.android.util.msg.mms.deprecated.MmsConnectivityManager$MyConnectivityReceiver(4986): onReceive(): Intent action is android.net.conn.CONNECTIVITY_CHANGE
11-25 10:59:09.085: I/ck.android.util.msg.mms.deprecated.MmsConnectivityManager$MyConnectivityReceiver(4986): No Conectivity Status: false, Reason :apnEnabled, FailOver :false, Current Network Info : **NetworkInfo: type: mobile[UMTS], state: CONNECTED/CONNECTED, reason: apnEnabled**, extra: www.vodafone.net.nz[disabled], roaming: false, failover: false, isAvailable: true, OtherNetwork Info :null
11-25 10:59:09.085: I/ck.android.util.msg.mms.deprecated.MmsConnectivityManager$MyConnectivityReceiver(4986): Current network type is **mobile**
11-25 10:59:09.085: I/ck.android.util.msg.mms.deprecated.MmsConnectivityManager$MyConnectivityReceiver(4986): Connection status: **true**
11-25 10:59:09.090: I/ck.android.util.msg.mms.deprecated.MmsConnectivityManager$1(4986): Watchdog has started
11-25 10:59:09.130: I/ck.android.spycam.CameraPreview(4986): surfaceCreated()
11-25 10:59:09.155: I/ck.android.spycam.CameraPreview(4986): surfaceCreated() has finished
11-25 10:59:09.155: I/ck.android.spycam.act.PictureTaker$1(4986): CameraPreviewCallback: Surface created
11-25 10:59:09.160: I/ck.android.spycam.CameraPreview(4986): Surface changed: We ignore this
11-25 10:59:09.160: I/ck.android.spycam.act.PictureTaker$1(4986): CameraPreviewCallback: Surface change completed
11-25 10:59:12.975: I/ck.android.util.msg.mms.deprecated.MmsConnectivityManager$MyConnectivityReceiver(4986): onReceive(): Intent action is android.net.conn.CONNECTIVITY_CHANGE
11-25 10:59:12.975: I/ck.android.util.msg.mms.deprecated.MmsConnectivityManager$MyConnectivityReceiver(4986): No Conectivity Status: false, Reason :apnEnabled, FailOver :false, Current Network Info : **NetworkInfo: type: mobile_mms[HSDPA], state: CONNECTED/CONNECTED, reason: apnEnabled**, extra: live.vodafone.com, roaming: false, failover: false, isAvailable: true, OtherNetwork Info :null
11-25 10:59:12.975: I/ck.android.util.msg.mms.deprecated.MmsConnectivityManager$MyConnectivityReceiver(4986): Current network type is **mobile_mms**
11-25 10:59:12.975: I/ck.android.util.msg.mms.deprecated.MmsConnectivityManager$MyConnectivityReceiver(4986): Connection status: **true**
11-25 10:59:12.975: I/ck.android.util.msg.mms.deprecated.MmsConnectivityManager$MyConnectivityReceiver(4986): MMS connectivity established
11-25 10:59:12.975: I/ck.android.util.msg.mms.deprecated.MmsConnectivityManager$MyConnectivityReceiver(4986): Watchdog is alive, so interrupting
11-25 10:59:12.975: I/ck.android.util.msg.mms.deprecated.MmsConnectivityManager$1(4986): Watchdog interrupted. Assuming we are now connected
11-25 10:59:12.980: I/ck.android.util.msg.mms.deprecated.MmsConnectivityManager(4986): Checking MMS connectivity state
11-25 10:59:12.980: I/ck.android.util.msg.mms.deprecated.MmsConnectivityManager(4986): We are now connected. **Now setting network preference to TYPE_MOBILE_MMS**
11-25 10:59:12.980: I/ck.android.util.msg.mms.deprecated.MmsConnectivityManager(4986): Firing mmsConnectivityEnabled
11-25 10:59:12.980: I/ck.android.spycam.act.PictureTaker$2(4986): MMS connectivity established. Taking picture ...
11-25 10:59:12.980: I/ck.android.spycam.act.PictureTaker$2(4986): **Debug: check connectivity to Vodafone NZ MMS proxy. Address is -1407310333**
11-25 10:59:12.985: I/ck.android.spycam.act.PictureTaker$2(4986): MMS: true
11-25 10:59:12.985: I/ck.android.spycam.act.PictureTaker(4986): Taking picture ...
11-25 10:59:14.030: I/ck.android.spycam.act.PictureTaker$4(4986): Shutter callback
11-25 10:59:14.435: I/ck.android.spycam.act.PictureTaker$5(4986): Raw picture callback.
11-25 10:59:14.525: W/ck.android.spycam.act.PictureTaker$5(4986): Picture data is null.
11-25 10:59:14.615: I/ck.android.spycam.act.PictureTaker$6(4986): Jpeg picture taken. 128909 bytes
11-25 10:59:14.615: I/ck.android.spycam.act.PictureTaker$6(4986): Sending PXT to +6421XXXXXXX
11-25 10:59:14.615: I/ck.android.util.msg.MsgUtil(4986): Sending JPEG via MMS to +6421XXXXXXX
11-25 10:59:14.620: I/ck.android.util.msg.MsgUtil(4986): Adding content to message
11-25 10:59:14.625: I/ck.android.util.msg.MsgUtil(4986): Message encoded
11-25 10:59:14.735: I/ck.android.util.msg.MsgUtil(4986): Getting list of APNs
11-25 10:59:14.765: I/ck.android.util.msg.MsgUtil(4986): Using APN: MMS Center URL: http://pxt.vodafone.net.nz/pxtsend, MMS Port: 8080, MMS Proxy: 172.030.038.003
11-25 10:59:14.770: I/ck.android.util.msg.MsgUtil(4986): [MMSCenter]http://pxt.vodafone.net.nz/pxtsend, [MMSProxy]172.030.038.003, [MMSPort]8080
11-25 10:59:14.770: I/ck.android.util.msg.mms.nokia.MMSender(4986): Sending...
11-25 10:59:14.770: I/ck.android.util.msg.mms.nokia.MMSender(4986): MMS URL is http://pxt.vodafone.net.nz/pxtsend
11-25 10:59:14.770: I/ck.android.util.msg.mms.nokia.MMSender(4986): Setting proxy to: 172.030.038.003:8080
11-25 10:59:14.770: I/ck.android.util.msg.mms.nokia.MMSender(4986): Proxy: HTTP//172.30.38.3:8080
11-25 10:59:14.770: I/ck.android.util.msg.mms.nokia.MMSender(4986): Creating decoder
11-25 10:59:14.770: I/ck.android.util.msg.mms.nokia.MMSender(4986): Decoding header
11-25 10:59:14.775: I/ck.android.util.msg.mms.nokia.MMSender(4986): Getting message
11-25 10:59:14.775: I/ck.android.util.msg.mms.nokia.MMSender(4986): Opening connection
11-25 10:59:14.775: I/ck.android.util.msg.mms.nokia.MMSender(4986): Connection opened. Using proxy: true. Setting doOutput
11-25 10:59:14.780: I/ck.android.util.msg.mms.nokia.MMSender(4986): Connection timeout is 0. Adding 60 seconds
11-25 10:59:14.780: I/ck.android.util.msg.mms.nokia.MMSender(4986): Connection timeout is now 60000
11-25 10:59:14.780: I/ck.android.util.msg.mms.nokia.MMSender(4986): Reading header
11-25 10:59:14.780: I/ck.android.util.msg.mms.nokia.MMSender(4986): [X-NOKIA-MMSC-Charging]100
11-25 10:59:14.780: I/ck.android.util.msg.mms.nokia.MMSender(4986): Setting request properties
11-25 10:59:14.780: I/ck.android.util.msg.mms.nokia.MMSender(4986): Getting output stream
11-25 10:59:52.245: I/ck.android.util.msg.mms.nokia.MMSender(4986): Closing connection
**11-25 10:59:52.250: I/ck.android.spycam.act.PictureTaker(4986): Failure: ck.android.util.msg.mms.nokia.MMSenderException: java.net.SocketTimeoutException: Connection timed out**
11-25 10:59:52.425: I/ck.android.util.msg.mms.deprecated.MmsConnectivityManager(4986): Now disabling MMS connectivity
11-25 10:59:52.445: I/ck.android.util.msg.mms.deprecated.MmsConnectivityManager(4986): Firing mmsConnectivityDisabled
11-25 10:59:52.445: I/ck.android.spycam.act.PictureTaker$2(4986): MMS connectivity finished normally`
Конструктор MmsConnectivityManager, где мы включаем функцию сети MMS
public MmsConnectivityManager(final Context context, final long timeout, MmsConnectivityCallback callback) throws MmsConnectivityException {
if(callback == null) {
throw new MmsConnectivityException("An MmsConnectivityCallback is required") ;
}
this.callback = callback ;
Util.logI("Obtaining connectivity manager") ;
cManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE) ;
IntentFilter filter = new IntentFilter();
filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
Util.logI("Registering receiver") ;
context.registerReceiver(myConnectivityReceiver, filter) ;
Util.logI("Attempting to use MMS network feature") ;
if(cManager.startUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE, PhoneEx.FEATURE_ENABLE_MMS) == -1) {
Util.logI("Cound not use MMS network feature") ;
context.unregisterReceiver(myConnectivityReceiver) ;
throw new MmsConnectivityException("Cound not use MMS network feature") ;
}
Util.logI("Now starting watchdog, which will wait for " + timeout + " milliseconds") ;
// now we wait for timeout milliseconds. If the service doesn't come up
// by then, we abort
watchdogThread = new Thread() {
public void run() {
Util.logI("Watchdog has started") ;
try {
Thread.sleep(timeout) ;
Util.logI("Watchdog timeout has expired. No interruption detected") ;
} catch (InterruptedException e) {
Util.logI("Watchdog interrupted. Assuming we are now connected") ;
connected = true ;
}
context.unregisterReceiver(myConnectivityReceiver) ;
checkConnectivityState(context) ;
}
} ;
watchdogThread.start() ;
}