Android WifiP2pConfig - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android WifiP2pConfig class.

This code example shows how to use the following methods:
        mListener = listener;
        mDevice = device;
    } 
 
    public WifiP2pConfig getConfig() {
        WifiP2pConfig config = new WifiP2pConfig();
        config.deviceAddress = mDeviceAddress.getText().toString();
        config.wps = new WpsInfo();
        switch (mWpsSetupIndex) {
            case WPS_PBC:
                config.wps.setup = WpsInfo.PBC;
                break; 
            case WPS_KEYPAD:
                config.wps.setup = WpsInfo.KEYPAD;
                /*config.wps.pin = ((TextView) mView.findViewById(R.id.wps_pin)). 
                        getText().toString();*/ 
                break; 
            case WPS_DISPLAY:
                config.wps.setup = WpsInfo.DISPLAY;
                break; 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
    /** 
     * Attempts to initiate a connection to the given device 
     * @param device The device of interest 
     */ 
	public void connectToDevice(WifiP2pDevice device) {
		WifiP2pConfig config = new WifiP2pConfig();
		config.deviceAddress = device.deviceAddress;
		 
		manager.connect(channel, config, new ActionListener() {
			 
			@Override 
			public void onSuccess() { 
                Toast.makeText(getApplicationContext(), "Connected to Device!", Toast.LENGTH_SHORT).show();
                Log.d(MyApplication.this.TAG, "Device Connected!");
                 
                for(OnDeviceConnectedListener listener : deviceConnectedListeners) {
                	listener.onDeviceConnected();
                } 
			} 
			 
Full Snippet Info
3
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
     * Initiate a connection with the peer. 
     */ 
    @Override 
    public void onListItemClick(ListView l, View v, int position, long id) {
        WifiP2pDevice device = (WifiP2pDevice) getListAdapter().getItem(position);
        WifiP2pConfig config = new WifiP2pConfig();
        config.deviceAddress = device.deviceAddress;
        config.wps.setup = WpsInfo.PBC;
        if (progressDialog != null && progressDialog.isShowing()) {
            progressDialog.dismiss();
        } 
        progressDialog = ProgressDialog.show(getActivity(), "Press back to cancel",
                "Connecting to :" + device.deviceAddress, true, true
                ); 
        ((DeviceActionListener) getActivity()).connect(config);
    } 
 
    /** 
     * Array adapter for ListFragment that maintains WifiP2pDevice list. 
     */ 
Full Snippet Info
4
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
   
  /** 
   * Listing 16-23: Requesting a connection to a Wi-Fi Direct peer 
   */ 
  private void connectTo(WifiP2pDevice device) {
    WifiP2pConfig config = new WifiP2pConfig();
    config.deviceAddress = device.deviceAddress;
 
    wifiP2pManager.connect(wifiDirectChannel, config, actionListener);
  } 
   
  /** 
   * Listing 16-24: Connecting to a Wi-Fi Direct peer 
   */ 
  BroadcastReceiver connectionChangedReceiver = new BroadcastReceiver() {
    @Override 
    public void onReceive(Context context, Intent intent) { 
       
      // Extract the NetworkInfo 
      String extraKey = WifiP2pManager.EXTRA_NETWORK_INFO; 
Full Snippet Info
3
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
	 *  
	 * @param targetDevice 
	 *            接続先のデバイス 
	 */ 
	public void connect(WifiP2pDevice targetDevice) {
		WifiP2pConfig config = new WifiP2pConfig();
		config.deviceAddress = targetDevice.deviceAddress;
		config.wps.setup = WpsInfo.PBC; // 接続時認証の指定(Push Button Configuration)
 
		mManager.connect(mChannel, config, null);
	} 
 
	/** 
	 * 接続中のPeerから切断する. 
	 */ 
	public void disconnect() { 
		mCallback.onDisconnect();
		mManager.removeGroup(mChannel, null);
	} 
 
Full Snippet Info
4
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
See Code Examples for Android WifiP2pConfig Methods: