android.net.wifi.p2p.nsd.WifiP2pDnsSdServiceRequest Java Examples
The following examples show how to use
android.net.wifi.p2p.nsd.WifiP2pDnsSdServiceRequest.
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: WifiDirectHandler.java From WiFi-Buddy with MIT License | 6 votes |
private void addServiceDiscoveryRequest() { serviceRequest = WifiP2pDnsSdServiceRequest.newInstance(); // Tell the framework we want to scan for services. Prerequisite for discovering services wifiP2pManager.addServiceRequest(channel, serviceRequest, new WifiP2pManager.ActionListener() { @Override public void onSuccess() { Log.i(TAG, "Service discovery request added"); } @Override public void onFailure(int reason) { Log.e(TAG, "Failure adding service discovery request: " + FailureReason.fromInteger(reason).toString()); serviceRequest = null; } }); }
Example #2
Source File: WifiController.java From gilgamesh with GNU General Public License v3.0 | 5 votes |
public void init (GilgaService service) { mService = service; mWifiManager = (WifiP2pManager) mService.getSystemService(Context.WIFI_P2P_SERVICE); mWifiChannel = mWifiManager.initialize(mService, mService.getMainLooper(), new ChannelListener() { @Override public void onChannelDisconnected() { Log.d(GilgaService.TAG,"wifi p2p disconnected"); } }); WifiP2pDnsSdServiceRequest serviceRequest = WifiP2pDnsSdServiceRequest.newInstance(); mWifiManager.addServiceRequest(mWifiChannel, serviceRequest, new ActionListener() { @Override public void onSuccess() { // Success! Log.d(TAG,"SUCCESS: added service request wifi name service"); } @Override public void onFailure(int code) { // Command failed. Check for P2P_UNSUPPORTED, ERROR, or BUSY Log.d(TAG,"FAILURED: added service request wifi name service: " + code); } }); }