Skip to content

Unable to use connect() in wifi-p2p #103

@FounderBrkandcnct

Description

@FounderBrkandcnct

Since from android 8 and above , android restricts to share the deviceAddress through wifi-direct . Connect() in wifi p2p is failing to connect since the argument to pass inside connect() is deviceAddress . Could you please help me with this @guptaamol @viniciuscb @qalqi @tyanbiao @seba9999 @kirillzyusko ?


const newSubscription = subscribeOnPeersUpdates(({ devices }) => {
      if (devices && devices.length > 0) {
        addLog(`New devices found: ${devices.length}`);
        devices.forEach((device, index) => {
          addLog(`Device ${index + 1}: ${device.deviceName || device.deviceAddress || 'Unknown'}`);
          connect(device.deviceName).then(() => {
            addLog(`successfully connected to ${device.deviceName}`);
          }).catch((err) => {
            addLog(`something gone wrong ${err}`);
          });
        });
      } else {
        addLog('No devices found');
      }
    });

    // Store subscription to clean it up later
    setSubscription(newSubscription);
  };

From the above code i'm trying to connect the devices discovered through wifi-direct using deviceName which is wrong . i know that . From the documentation you provided tells to use DeviceAddress to connect which android restricts now . Then how to connect to discovered peers @kirillzyusko ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions