WiFi P2P network in Android Things

2019-05-06 12:01发布

问题:

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); .... } }

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

No service published for: wifip2p
and the WifiP2pManager is not retrieved.

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?

回答1:

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.