Java Code Examples for android.net.wifi.p2p.WifiP2pManager#ActionListener
The following examples show how to use
android.net.wifi.p2p.WifiP2pManager#ActionListener .
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 File: WiFiP2pHelper.java From libcommon with Apache License 2.0 | 6 votes |
/** * 切断する */ protected void internalDisconnect(final WifiP2pManager.ActionListener listener) { if (DEBUG) Log.v(TAG, "internalDisconnect:"); if (mWifiP2pManager != null) { if ((mWifiP2pDevice == null) || (mWifiP2pDevice.status == WifiP2pDevice.CONNECTED)) { // 接続されていないか、既に接続済みの時 if (mChannel != null) { mWifiP2pManager.removeGroup(mChannel, listener); } } else if (mWifiP2pDevice.status == WifiP2pDevice.AVAILABLE || mWifiP2pDevice.status == WifiP2pDevice.INVITED) { // ネゴシエーション中の時 mWifiP2pManager.cancelConnect(mChannel, listener); } } }
Example 2
Source File: Salut.java From Salut with MIT License | 6 votes |
protected void forceDisconnect() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { WifiP2pManager.ActionListener doNothing = new WifiP2pManager.ActionListener() { @Override public void onSuccess() { } @Override public void onFailure(int reason) { } }; stopServiceDiscovery(false); manager.cancelConnect(channel, doNothing); manager.clearLocalServices(channel, doNothing); manager.clearServiceRequests(channel, doNothing); manager.stopPeerDiscovery(channel, doNothing); } }
Example 3
Source File: P2pManager.java From ShareBox with Apache License 2.0 | 5 votes |
public void connect(WifiP2pDevice device,WifiP2pManager.ActionListener listener) { WifiP2pConfig config=new WifiP2pConfig(); config.deviceAddress=device.deviceAddress; config.wps.setup= WpsInfo.PBC; _wifiP2pManager.connect(_channel, config, listener); }
Example 4
Source File: P2pManager.java From ShareBox with Apache License 2.0 | 4 votes |
public void discoverPeers(WifiP2pManager.ActionListener listener) { _wifiP2pManager.discoverPeers(_channel, listener); }