I want to send message (question:if particular file available or not) and want answer from other android devices (if file is available:yes).For this I am sending udp broadcast message on local network to ask devices at once and afterwards sending file with tcp protocol which works fine. But sometimes android device doesn't receive udp messages on screen off. I have also acquired wake lock and multicast lock in broadcast receiver which detects screen off but it doesn't work.Please help! Thanks..
PowerManager powerManager =
(PowerManager)context.getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "MyWakelockTag");
wakeLock.acquire();
WifiManager.MulticastLock multicastLock = wifiManager.createMulticastLock("lockWifiMulticast");
multicastLock.acquire();
WifiManager.WifiLock wifiLock = wifiManager.createWifiLock(WifiManager.WIFI_MODE_FULL_HIGH_PERF,"MyWifiLock");
wifiLock.acquire();