Sending MMS Through Android Code

1.7k views Asked by At

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.

1

There are 1 answers

2
apmeyers1987 On BEST ANSWER

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);