Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

android discovery not working #46

Open
ashmortar opened this issue May 7, 2018 · 6 comments
Open

android discovery not working #46

ashmortar opened this issue May 7, 2018 · 6 comments

Comments

@ashmortar
Copy link

I have set up a project in react-native and am trying to locate peers and advertise via bluetooth but when i getNearbyPeers the array returned is always empty. Are there any examples of how this is supposed to work?

@HZSamir
Copy link

HZSamir commented May 16, 2018

This is how I personally go about it:

BluetoothCP.advertise();
    // BluetoothCP.browse();

    BluetoothCP.addPeerDetectedListener(function(user) {
      if (typeof user !== 'undefined' && user !== null) {
        BluetoothCP.inviteUser(user.id);
        self.props.dispatch(SessionStateActions.addUser());
      }
    });

    BluetoothCP.addPeerLostListener(function(user) {
      self.setState({usersNumber: self.state.usersNumber - 1});
      if (typeof user !== 'undefined' && user !== null) {
        BluetoothCP.disconnectFromPeer(user.id);
        self.props.dispatch(SessionStateActions.removeUser());
      }
    });

    BluetoothCP.addInviteListener(function(user) {
      if (typeof user !== 'undefined' && user !== null) {
        BluetoothCP.acceptInvitation(user.id);
      }
    });

I have to check the user object because sometimes it would return an undefined
The action dispatched just logs the new discovered user somewhere in my app.

@vimalathiyagu
Copy link

@virl I am also facing the same issue. I am using android 8 and only when wifi is turned on (But no internet) along bluetooth only then discovery works. It is not working only with bluetooth alone. Previously only bluetooth was working fine on android versions below 8.

Is there any specific handling to be done for devices above Android 7. Kindly clarify.

@virl
Copy link

virl commented Jul 31, 2018

@vimalathiyagu Currently Bluetooth discovery and communication are not supported when both devices are Android 8+.

@vimalathiyagu
Copy link

Thanks @virl

@tonmanayo
Copy link

@virl will bluetooth be working again anytime soon?

@MaksymilianWojcik
Copy link

hey @virl is there any update on 8+ versions issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants