android.net.wifi.p2p.WifiP2pDeviceList Java Examples
The following examples show how to use
android.net.wifi.p2p.WifiP2pDeviceList.
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 Author: lulululbj File: WifiDisplayController.java License: Apache License 2.0 | 6 votes |
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
Source Project: Wifi-Connect Author: anitaa1990 File: WifiP2PServiceImpl.java License: Apache License 2.0 | 6 votes |
@Override public synchronized void handleOnPeersChangedResponse() { manager.requestPeers(channel, new WifiP2pManager.PeerListListener() { @Override public void onPeersAvailable(final WifiP2pDeviceList wifiP2pDeviceList) { if(wifiP2PConnectionCallback != null) { activity.runOnUiThread(new Runnable() { @Override public void run() { wifiP2PConnectionCallback.onPeerAvailable(wifiP2pDeviceList); } }); } } }); }
Example #3
Source Project: physical-web Author: google File: WifiUrlDeviceDiscoverer.java License: Apache License 2.0 | 6 votes |
@Override public void onPeersAvailable(WifiP2pDeviceList list) { Log.d(TAG, list.toString()); for (WifiP2pDevice device : list.getDeviceList()) { Utils.WifiDirectInfo info = Utils.parseWifiDirectName(device.deviceName); if (info != null) { String name = info.title; int port = info.port; reportUrlDevice(createUrlDeviceBuilder("WifiDirect" + name, device.deviceAddress + ":" + port) .setWifiAddress(device.deviceAddress) .setWifiPort(port) .setTitle(name) .setDescription("") .setDeviceType(Utils.WIFI_DIRECT_DEVICE_TYPE) .build()); } } }
Example #4
Source Project: Wifi-Connect Author: anitaa1990 File: DeviceListFragment.java License: Apache License 2.0 | 5 votes |
public void onDeviceAvailable(final WifiP2pDeviceList wifiP2pDeviceList) { activity.runOnUiThread(new Runnable() { @Override public void run() { if(recyclerView.isEnabled()) { progressView.setVisibility(View.GONE); emptyView.setVisibility(View.GONE); recyclerView.setVisibility(View.VISIBLE); swipeRefreshLayout.setVisibility(View.VISIBLE); wifiListAdapter.addDevices(new ArrayList<>(wifiP2pDeviceList.getDeviceList())); recyclerView.addOnItemTouchListener(new RecyclerItemClickListener(activity, DeviceListFragment.this)); } } }); }
Example #5
Source Project: Wrox-ProfessionalAndroid-4E Author: retomeier File: WiFiDirectActivity.java License: Apache License 2.0 | 5 votes |
@Override public void onReceive(Context context, Intent intent) { mWifiP2pManager.requestPeers(mWifiDirectChannel, new WifiP2pManager.PeerListListener() { public void onPeersAvailable(WifiP2pDeviceList peers) { // TODO Update UI with new list of peers. } }); }
Example #6
Source Project: ShareBox Author: Kerr1Gan File: P2pConnect.java License: Apache License 2.0 | 5 votes |
@Override public void onPeersAvailable(WifiP2pDeviceList peers) { for(WifiP2pDevice device:peers.getDeviceList()) { Log.i(TAG,device.toString()); } _p2pDeviceList.clear(); _p2pDeviceList.addAll(peers.getDeviceList()); }
Example #7
Source Project: libcommon Author: saki4510t File: WiFiP2pHelper.java License: Apache License 2.0 | 5 votes |
@Override public void onPeersAvailable(final WifiP2pDeviceList peers) { if (DEBUG) Log.v(TAG, "onPeersAvailable:peers=" + peers); final Collection<WifiP2pDevice> devices = peers.getDeviceList(); synchronized (mAvailableDevices) { mAvailableDevices.clear(); mAvailableDevices.addAll(devices); } callOnUpdateDevices(mAvailableDevices); }
Example #8
Source Project: Demo_Public Author: coderminer File: DeviceListFragment.java License: MIT License | 5 votes |
@Override public void onPeersAvailable(WifiP2pDeviceList peersList) { if(progressDialog != null && progressDialog.isShowing()) progressDialog.dismiss(); peers.clear(); peers.addAll(peersList.getDeviceList()); ((WiFiPeerListAdapter)getListAdapter()).notifyDataSetChanged(); if(peers.size() == 0){ Log.e(WiFiDirectActivity.TAG, "the peers size is 0"); return; } }
Example #9
Source Project: WiFi-Buddy Author: Crash-Test-Buddies File: WifiDirectHandler.java License: MIT License | 5 votes |
/** Constructor **/ public WifiDirectHandler() { super(ANDROID_SERVICE_NAME); dnsSdTxtRecordMap = new HashMap<>(); dnsSdServiceMap = new HashMap<>(); peers = new WifiP2pDeviceList(); }
Example #10
Source Project: android-p2p Author: lukoerfer File: P2pChatService.java License: MIT License | 5 votes |
@Override public void onPeersAvailable(WifiP2pDeviceList deviceList) { Collection<WifiP2pDevice> foundDevices = deviceList.getDeviceList(); boolean devicesRemoved = this.Devices.retainAll(foundDevices); boolean devicesAdded = this.Devices.addAll(foundDevices); if (devicesRemoved || devicesAdded) { this.updateDevices(); } }
Example #11
Source Project: commcare-android Author: dimagi File: DeviceListFragment.java License: Apache License 2.0 | 5 votes |
@Override public void onPeersAvailable(WifiP2pDeviceList peerList) { Log.d(TAG, "onPeersAvailable"); if (progressDialog != null && progressDialog.isShowing()) { progressDialog.dismiss(); } peers.clear(); peers.addAll(peerList.getDeviceList()); ((WiFiPeerListAdapter)getListAdapter()).notifyDataSetChanged(); if (peers.size() == 0) { Log.d(TAG, "No devices found"); } }
Example #12
Source Project: Wifi-Connect Author: anitaa1990 File: SenderActivity.java License: Apache License 2.0 | 4 votes |
@Override public void onDeviceAvailable(WifiP2pDeviceList wifiP2pDeviceList) { Fragment fragment = getCurrentFragment(); if(fragment instanceof DeviceListFragment) ((DeviceListFragment)fragment).onDeviceAvailable(wifiP2pDeviceList); }
Example #13
Source Project: Wifi-Connect Author: anitaa1990 File: SenderActivity.java License: Apache License 2.0 | 4 votes |
@Override public void onPeerAvailable(WifiP2pDeviceList wifiP2pDeviceList) { onDeviceAvailable(wifiP2pDeviceList); }
Example #14
Source Project: nfcspy Author: sinpolib File: WiFiP2PCommand.java License: GNU General Public License v3.0 | 4 votes |
@Override public void onPeersAvailable(WifiP2pDeviceList peers) { onFinished(STA_SUCCESS, peers.getDeviceList()); }
Example #15
Source Project: gilgamesh Author: n8fr8 File: WifiController.java License: GNU General Public License v3.0 | 4 votes |
@Override public void onPeersAvailable(WifiP2pDeviceList peerList) { Collection<WifiP2pDevice> deviceList = peerList.getDeviceList(); for (WifiP2pDevice device : deviceList) { boolean trusted = false; //not sure how to do this with wifi if (!GilgaService.mapToNickname(device.deviceAddress).startsWith(mLocalAddressHeader)) //not me mService.processInboundMessage(device.deviceName,device.deviceAddress,trusted); } }
Example #16
Source Project: Wifi-Connect Author: anitaa1990 File: ReceiverActivity.java License: Apache License 2.0 | 2 votes |
@Override public void onPeerAvailable(WifiP2pDeviceList wifiP2pDeviceList) { }
Example #17
Source Project: ShareBox Author: Kerr1Gan File: P2pReceiver.java License: Apache License 2.0 | 2 votes |
@Override public void onPeersAvailable(WifiP2pDeviceList peers) { }
Example #18
Source Project: Wifi-Connect Author: anitaa1990 File: WifiP2PConnectionCallback.java License: Apache License 2.0 | votes |
void onPeerAvailable(WifiP2pDeviceList wifiP2pDeviceList);
Example #19
Source Project: Wifi-Connect Author: anitaa1990 File: OnSenderUIListener.java License: Apache License 2.0 | votes |
void onDeviceAvailable(final WifiP2pDeviceList wifiP2pDeviceList);