Android Things中的WiFi P2P网络

问题描述:

我想使用Android Things(5.1)和几个Raspberry Pi 3或使用蓝牙来创建P2P WiFi网络.我遵循了Android开发者部分 https://developer.android.com中的指南/guide/topics/connectivity/wifip2p.html ,所以我的MainActivity如下:

I would like to create a P2P WiFi network using Android Things (5.1) and a couple of Raspberry Pi 3 or alternatively using Bluetooth. I followed the guide in the Android Developer section https://developer.android.com/guide/topics/connectivity/wifip2p.html, so my MainActivity looks like:

private class MainActtivity { private WifiP2pManager mManager; .... @Override public void onCreate(Bundle savedInstances) { mManager = (WifiP2pManager) getSystemService(Context.WIFI_P2P_SERVICE); .... } }

private class MainActtivity { private WifiP2pManager mManager; .... @Override public void onCreate(Bundle savedInstances) { mManager = (WifiP2pManager) getSystemService(Context.WIFI_P2P_SERVICE); .... } }

但是,当我尝试在启用WiFI的情况下运行该应用程序时,SystemServiceRegistry会显示一条消息,指出

However when I try to run the app, with WiFI enabled, the SystemServiceRegistry shows a message stating

没有发布针对wifip2p
No service published for: wifip2p

的服务,并且未检索到WifiP2pManager.

and the WifiP2pManager is not retrieved.

如何解决此问题?有人知道是否可以使用WiFi Direct和Android Things创建WiFi P2P网络吗?

How can I solve this issue? Does anybody know if it is possible to create a WiFi P2P network using WiFi Direct and Android Things?

到目前为止(Android稳定版本1.0),RPI3B不支持WifiP2P,因此请尝试使用

As of now (Android things stable release 1.0) WifiP2P is not supported on RPI3B,Hence try to use Google NearBy 2.0 API as alternative I think it will satisfy your need.