kirillzyusko / react-native-wifi-p2p

Library that provide access for working with wi-fi direct (p2p) module in android.
164 stars 32 forks source link

Require Group Passphrase #9

Closed qalqi closed 4 years ago

qalqi commented 4 years ago

Hi, This is a great library. Once a group is created, we need passphrase from it.

Currently, only way to get it is manually and not programmatically from i.e Settings -> WIFI Direct -> Passphrase

Here is a snippet shared by android developer https://developer.android.com/training/connect-devices-wirelessly/wifi-direct#java

manager.requestGroupInfo(channel, new GroupInfoListener() {
  @Override
  public void onGroupInfoAvailable(WifiP2pGroup group) {
      String groupPassword = group.getPassphrase();
  }
});
kirillzyusko commented 4 years ago

Hi, @qalqi Yes, you are absolutely right I will implement this method as soon as possible Do I correct understand, that you need a method in JS, which will return groupPassword from your code snippet?

qalqi commented 4 years ago

Raised PR. https://github.com/kirillzyusko/react-native-wifi-p2p/pull/10
Please review it.

kirillzyusko commented 4 years ago

@qalqi May I ask you why do we need to wait ~3 s in order to call to another function?

qalqi commented 4 years ago

createGroup().then(_ => (getGroupPassphraseInfo()) is resulting in null password. If called after a second or so after creating a group, I am receiving group passphrase.

kirillzyusko commented 4 years ago

It's a little bit strange But I think we can move forward even with this

qalqi commented 4 years ago

Tx

kirillzyusko commented 4 years ago

@qalqi I published new version (0.6.7) with your changes :)