在我的应用中,isLock没有发布。我测试了三星手机中的应用程序,它工作正常但在Moto G棒棒糖版本中,isLock没有发布。我不知道问题的实际原因。请指导我..问题是什么..
下面是我的源代码
if(brSocket != null){
brSocket.close();
brSocket = null;
wifii = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
if(wifii == null) {
return;
}
if(isLocked == true) {
lock = wifii.createMulticastLock("m_Lock");
if (lock != null) {
Log.v("W","lock is not null");
if (lock.isHeld()) {
Log.v("i","Release the lock");
lock.release();
}
isLocked = false;
}else{
Log.v("i","lock is NULL");
}
}
}
if(lanSocket != null){
lanSocket.close();
lanSocket = null;
}
}