Question

I'm looking at the code posted here for sending MMS through an Android Application, and I'm very close. I have successfully sent an MMS while the Wifi connection is NOT enabled. But when it comes time to use the httpConnection in never connections when Wifi is enabled. I've read several posts saying to use

ConnectivityManager.requestRouteToHost(ConnectivityManager.TYPE_MOBILE_MMS,APNBACKENDIP);

And that function returns true meaning that it should route traffic over the TYPE_MOBILE_MMS interface, but it always times out. Can anyone point me in the right direction? Also I tried using TYPE_MOBILE instead of TYPE_MOBILE_MMS and the function returns false instead.

Was it helpful?

Solution

Turns out it was an incredibly simple answer....I had my IP quad reversed when calculating the IP address for requestRouteToHost.

I.E I had:

int address = ((addr[0] & 0xFF) << 24) | ((addr[1] & 0xFF) << 16) | ((addr[2] & 0xFF) << 8) | (addr[3] & 0xFF);

Whereas it should be:

int address = ((addr[3] & 0xFF) << 24) | ((addr[2] & 0xFF) << 16) | ((addr[1] & 0xFF) << 8) | (addr[0] & 0xFF);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top