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?
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
.
精彩评论