public void init (GilgaService service)
{
mService = service;
mWifiManager = (WifiP2pManager) mService.getSystemService(Context.WIFI_P2P_SERVICE);
mWifiChannel = mWifiManager.initialize(mService, mService.getMainLooper(), new ChannelListener()
{
@Override
public void onChannelDisconnected() {
Log.d(GilgaService.TAG,"wifi p2p disconnected");
}
});
WifiP2pDnsSdServiceRequest serviceRequest = WifiP2pDnsSdServiceRequest.newInstance();
mWifiManager.addServiceRequest(mWifiChannel,
serviceRequest,
new ActionListener() {
@Override
public void onSuccess() {
// Success!
Log.d(TAG,"SUCCESS: added service request wifi name service");
}
@Override
public void onFailure(int code) {
// Command failed. Check for P2P_UNSUPPORTED, ERROR, or BUSY
Log.d(TAG,"FAILURED: added service request wifi name service: " + code);
}
});
}
WifiController.java 文件源码
java
阅读 36
收藏 0
点赞 0
评论 0
项目:gilgamesh
作者:
评论列表
文章目录