0

I'm trying to discover some mobile devices using jmdns. As long as i have wifi or 3G connection, the devices are discoverable. Ever since, i used 4G connection, it said that no devices are detected.

ConnectivityManager conMgr = (ConnectivityManager) getSystemService (Context.CONNECTIVITY_SERVICE);
if ( conMgr.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).getState() == NetworkInfo.State.CONNECTED 
                || conMgr.getNetworkInfo(ConnectivityManager.TYPE_WIFI).getState() == NetworkInfo.State.CONNECTED ) {}

Do I have to put another condition to enable 4G connection? what's the most significant differences between 4G and 3G programmatically?

manlio
  • 18,345
  • 14
  • 76
  • 126
sigit_prayoga
  • 121
  • 1
  • 8

1 Answers1

0

I'm quite surprised it works on 3g.

Bonjour/Zeroconf uses mDNS to discover other devices IP addresses. It uses multicast UDP to announce itself to others. I'm quite sure this does not work on 3g networks as they use NAT to separate users from each other and to prevent devices on internet connecting to them (inbound connections - internet to 3g device). Reads this guys testing of multicast UDP on 3g: http://sourceforge.net/projects/open-dis/forums/forum/683284/topic/4058262

Update

For detecting the network on current 4g devices you should check the ConnectivityManager.TYPE_WIMAX.

Peter Knego
  • 79,991
  • 11
  • 123
  • 154
  • Oops, I think I didn't switch off the wifi. Yeah, you're right, that's not even working with 3G. I got it now, thanks for great explanation :) – sigit_prayoga Oct 11 '11 at 20:34
  • One other problem i'd like to find out. If I only use, 3G connection, it won't detect any device, but at least, the apps is running with internet connection. But when I'm using 4G connection, it says that "no connection at all" – sigit_prayoga Oct 11 '11 at 23:03
  • Hard to say without seeing errors or code. This are two separate problems. – Peter Knego Oct 12 '11 at 06:01