问题描述
当我调用此方法 createGroup(wifip2pManager.Channel c,wifip2pManager.ActionListener listener)
时,它起作用了。
但我想设置一些配置,所以我调用 createGroup(wifip2pManager.Channel c,wifip2pConfig config,wifip2pManager.ActionListener listener)
,它出错了。
这是我的代码:
wifip2pConfig config = new wifip2pConfig.Builder()
.enablePersistentMode(true)
.setNetworkName("DIRECT-xy-MEIZU 16s")
.setPassphrase("wanghui123456")
.setDeviceAddress(MacAddress.fromString("72:8E:BA:03:F1:16"))
.setGroupOperatingBand(wifip2pConfig.GROUP_OWNER_BAND_5GHZ)
.build();
Log.d(TAG,"onCreateBackgroundJob: " + config.describeContents() + config.toString());
if (ActivityCompat.checkSelfPermission(this,Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// Todo: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions,and then overriding
// public void onRequestPermissionsResult(int requestCode,String[] permissions,// int[] grantResults)
// to handle the case where the user grants the permission. See the documentation
// for ActivityCompat#requestPermissions for more details.
return;
}
manager.createGroup(channel,config,new wifip2pManager.ActionListener() {
@Override
public void onSuccess() {
Log.d(TAG,"onSuccess: ");
}
@Override
public void onFailure(int reason) {
Log.d(TAG,"onFailure: " + reason);
}
});
我得到的日志是 onFailure: 0
错误
在 API 级别 14 中添加
public static final int ERROR
通过 ActionListener#onFailure。表示操作因内部错误而失败。
常量值:0 (0x00000000))
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)