Java Code Examples for android.net.wifi.p2p.WifiP2pManager.PeerListListener

The following examples show how to use android.net.wifi.p2p.WifiP2pManager.PeerListListener. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: android_9.0.0_r45   Source File: WifiDisplayController.java    License: Apache License 2.0 6 votes vote down vote up
private void requestPeers() {
    mWifiP2pManager.requestPeers(mWifiP2pChannel, new PeerListListener() {
        @Override
        public void onPeersAvailable(WifiP2pDeviceList peers) {
            if (DEBUG) {
                Slog.d(TAG, "Received list of peers.");
            }

            mAvailableWifiDisplayPeers.clear();
            for (WifiP2pDevice device : peers.getDeviceList()) {
                if (DEBUG) {
                    Slog.d(TAG, "  " + describeWifiP2pDevice(device));
                }

                if (isWifiDisplay(device)) {
                    mAvailableWifiDisplayPeers.add(device);
                }
            }

            if (mDiscoverPeersInProgress) {
                handleScanResults();
            }
        }
    });
}
 
Example 2
@Override
public void updatePeers() {
    Logger.log(TAG, "Wi-Fi direct peers updating");
    mManager.requestPeers(mChannel, (PeerListListener)this.getSupportFragmentManager()
            .findFragmentById(R.id.frag_list));

}
 
Example 3
Source Project: letv   Source File: LeBoxNetworkManager.java    License: Apache License 2.0 4 votes vote down vote up
public void requestP2pPeers(PeerListListener peerListListener) {
    LeBoxWifiDirectModel.getInstance().requestPeers(peerListListener);
}