bentalebahmed / BlueUnity

Plugin for using Bluetooth modules like HC-05 and HC-06 with Unity3d Android
MIT License
98 stars 27 forks source link

Need to Get List of Avaible device how can i get ? #7

Closed kartikkumar783 closed 2 months ago

bentalebahmed commented 2 months ago

Use Get Paired Devices function or Search Devices function

kartikkumar783 commented 2 months ago

Get Paired Devices giving the list of paired device I want list of available devices

bentalebahmed commented 2 months ago

use StartScanDevices function, it will send back the available devices on NewDeviceFound as a callback with device info as data="MAC+NAME". you can stack all returned devices one by one in a list.

kartikkumar783 commented 2 months ago
public void NewDeviceFound(string data)
{
    Debug.Log("New Device Found...");
    GameObject newDevice = deviceMACText;
    newDevice.GetComponent<Text>().text = data;
    Instantiate(newDevice, devicesListContainer.transform);  
}
This method is not calling tested
bentalebahmed commented 2 months ago

Did you test the provided app? to see if it works for your BT device? does the device use BLE ? if yes, the plug-in will not work for you Also, the plug-in will not work on mobile-to-mobile BT connection What version of Android phone are you using? Did your build request BT and location permissions? I need more details and context to be able to help

kartikkumar783 commented 2 months ago

Android Version 13 Yes All Permissions were granted

bentalebahmed commented 2 months ago

Did you test the provided app? what type of BT module you are trying to use ?

kartikkumar783 commented 2 months ago

Trying this on Android Mobile, Yes tested provided also not working in that also

bentalebahmed commented 2 months ago

What type of BT module do you have?

kartikkumar783 commented 2 months ago

https://github.com/bentalebahmed/BlueUnity/assets/30552447/84515282-163d-4435-8a4a-2dc61078a69c

I am checking in my android phone,its giving me list of paired devices

bentalebahmed commented 2 months ago

draw a circle with your finger on the screen, it will open a debug console, See if you get errors

kartikkumar783 commented 2 months ago

No Error were there tried everything possible troubleshoot 🥺

bentalebahmed commented 2 months ago

What type of BT module you have? A photo will help

kartikkumar783 commented 2 months ago

Resolved the issue by enabling the Location of the Phone