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

Peripheral connection disconnected... #3

Open
darshitpolaris opened this issue Feb 11, 2022 · 7 comments
Open

Peripheral connection disconnected... #3

darshitpolaris opened this issue Feb 11, 2022 · 7 comments

Comments

@darshitpolaris
Copy link

While I'm trying to connect the peripheral it's working fine but after some, while peripheral disconnects automatically.

@dhruvanb
Copy link

Hi @darshitpolaris,
I'm trying to connect with the device but I'm not getting the Bluetooth device list in onMessageReceived method. can you please attach some working examples?

@darshitpolaris
Copy link
Author

darshitpolaris commented May 16, 2022

Hii @dhruvanb

Have you added any Bluetooth permission in the android manifest
for below android 11, you need to add

    <uses-permission android:name="android.permission.BLUETOOTH" />  
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />  
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>  
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

and for android 12 you need to add this permission for bluetooth scan

    <uses-permission android:name="android.permission.BLUETOOTH_SCAN"/>
   <uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>
   
   for ios,
   add this permission in info.plist
      <key>NSBluetoothAlwaysUsageDescription</key>  
    <string>Need BLE permission</string>  
    <key>NSBluetoothPeripheralUsageDescription</key>  
    <string>Need BLE permission</string>  
    <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>  
    <string>Need Location permission</string>  
    <key>NSLocationAlwaysUsageDescription</key>  
    <string>Need Location permission</string>  
    <key>NSLocationWhenInUseUsageDescription</key>  
    <string>Need Location permission</string>

@dhruvanb
Copy link

Hi @darshitpolaris,
yes, I have added it and modified the code as per my requirement.

@darshitpolaris
Copy link
Author

@dhruvanb Are you getting Bluetooth list??

@dhruvanb
Copy link

@darshitpolaris please check OP mode in native code by setting setOpMode method.

@darshitpolaris
Copy link
Author

@dhruvanb I'm not getting what you say.

@SalmanSheikIsmail
Copy link

@darshitpolaris @dhruvanb Does the issue still exist?

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

3 participants