我想在没有手持设备的情况下在两个或更多智能手表之间建立连接。
我做了这个测试来检查支持
FeatureInfo[] features = getPackageManager().getSystemAvailableFeatures();
for (FeatureInfo info : features) {
if (info != null && info.name != null && info.name.equalsIgnoreCase("android.hardware.wifi.direct")) {
Log.i("wear main", "wifi direct supported");
return;
}
}
Log.i("wear main", "wifi direct not supported");
由于以下监听器可以判断该服务是否可用,因此我也进行了此测试
WifiP2pManager mManager = (WifiP2pManager) getSystemService(Context.WIFI_P2P_SERVICE);
Channel mChannel = mManager.initialize(this, getMainLooper(), null);
mManager.discoverPeers(mChannel, new WifiP2pManager.ActionListener() {
@Override
public void onSuccess() {
Log.i("wear main", "wifi direct supported");
return;
}
@Override
public void onFailure(int reasonCode) {
Log.i("wear main", "wifi direct not supported");
return;
}
});
我只能看到它不受支持(使用sony smartwatch 3)。是否有可能在Android服装中使用Wifi直接?