I am trying to download the MMS
picture content through the MMS url, but it returns with a 403 (Forbidden) server response with an invalid MSISDN
numbe
Now I am able to find out the solution but I find that sometime the download code doesn't work but when you try again it works although what I was missing first establishing the connectivity to the server. I have mention below the connectivity method and after this call the method name downloadThroughGateway(parameters) which is mention on this question code.
private void startConnectivity() throws Exception {
ConnectivityManager mConnMgr = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
if (!mConnMgr.getNetworkInfo(ConnectivityManager.TYPE_MOBILE_MMS)
.isAvailable()) {
throw new Exception("Not available yet");
}
int count = 0;
int result = beginMmsConnectivity(mConnMgr);
if (result != PhoneEx.APN_ALREADY_ACTIVE) {
NetworkInfo info = mConnMgr
.getNetworkInfo(ConnectivityManager.TYPE_MOBILE_MMS);
while (!info.isConnected()) {
Thread.sleep(1500);
info = mConnMgr
.getNetworkInfo(ConnectivityManager.TYPE_MOBILE_MMS);
Log.d(">>>", "Waiting for CONNECTED: state=" + info.getState());
if (count++ > 5)
throw new Exception("Failed to connect");
}
}
Thread.sleep(1500);
}