How can I scan BluetoothDevice ?

RafeeqRafeeq USMember ✭✭

I have Tagged the Project below .When I am Scanning Bluetooth devices it was not supporting .....
can any one tell me what was the reason and what i have to do to clear it
I am using visualstudiod 2015 xamarinforms , system windows 10.

Answers

  • AlbertKAlbertK MYMember ✭✭✭

    Hi,

    1) Try Download the nRF from the google play store. If you cannot download it then your phone is too old. Time to buy a new one.
    2) If you can download and install then try to scan for the device you have that support Bluetooth LE. If can be found then good otherwise it could be the device is not switched on or it is not BlueTooth LE capable.

  • ChristopheBERNARDChristopheBERNARD BEMember ✭✭✭✭

    Hello @Rafeeq

    read perhaps this article
    http://toomanytutorials.blogspot.lu/2015/03/scanning-for-bluetooth-devices-in.html

    it's on java sorry but you can find the same api (approximativaly) with c#

    have a nice xmas

  • RafeeqRafeeq USMember ✭✭

    @ChristopheBERNARD said:
    Hello @Rafeeq

    read perhaps this article
    http://toomanytutorials.blogspot.lu/2015/03/scanning-for-bluetooth-devices-in.html

    it's on java sorry but you can find the same api (approximativaly) with c#

    have a nice xmas

    Hi,
    I have already saw this link.But i am getting so many errors as
    "cannot implicitly convert type to 'java.lang.object' to android.Bluetooth.BluetoothDevice"
    I have been searching from past one week but i could not able to find it.so can you please provide me the source code for "scanning" for finding bluetooth devices nearby us in c#.....Thank you

  • AlbertKAlbertK MYMember ✭✭✭

    Hi,

    You can use the Bluetooth LE plugin. Get it from Nuget or compile it from source (Github). It works and I have been using it and it way better then all those half baked solution out there and long abandoned. At least this one is actively maintained and developed.

    https://github.com/xabre/xamarin-bluetooth-le

    or

    https://www.nuget.org/packages/Plugin.BLE/1.1.0

  • RafeeqRafeeq USMember ✭✭

    I have Tried The Code as below Everthing From Previous Links .But my Problem is I am not getting the scanned Device .So please can any on explain me how can i Scan bluetooth devices in This app. I Want just click event to the button scanner and get all devices near by ...Please.................. ThankYou

  • RafeeqRafeeq USMember ✭✭

    I have tried all the links and finally i have done below project .But i have problem in scanning button can any one help me to rectify this problem in this project please.........................Thank you

  • RafeeqRafeeq USMember ✭✭

    I have tried all the links and finally i have done below project .But i have problem in scanning button can any one help me to rectify this problem in this project please.........................Thank you

  • ErikHa.5803ErikHa.5803 VNMember ✭✭

    I don't quite understand what you are trying to accomplish. When you click the scan button, what happens next ?

  • RafeeqRafeeq USMember ✭✭

    When I Click scan Button I want to Scan All Bluetooth Devices near by that Device in a list

  • ErikHa.5803ErikHa.5803 VNMember ✭✭
    Sorry for the late reply.
    The first thing you might want to do is to take a brief look at bluetooth API in android documentation.
    https://developer.android.com/guide/topics/connectivity/bluetooth.html#FindingDevices

    In Xamarin.Android the device finding procedure is exactly the same and can be illustrated in 3 steps:

    1. Prepare a BroadcastReceiver to listen to OS's ACTION_FOUND intent, which will contain each found device's information. This is where you add device's name or MAC address to your list
    2. Set up BroadcastReceiver by registering and unregistering it in your activity.
    3. Call BluetoothAdapter.StartDiscovery()
  • RafeeqRafeeq USMember ✭✭

    I have already tried that one and i have
    error :
    "cannot implicitly convert type to 'java.lang.object' to android.Bluetooth.BluetoothDevice"

  • ErikHa.5803ErikHa.5803 VNMember ✭✭
    can you show me some part of your code so I can have a check ?
  • RafeeqRafeeq USMember ✭✭
    edited December 2016

    I have attached my code and i have commented as like this "// I am getting Error at this Part of my Program............................."
    where i have occurred the error .Thank you

  • ErikHa.5803ErikHa.5803 VNMember ✭✭
    What kind of error did you get? If I read your note correctly, the error should be something related to BluetoothAdapter. Have you successfully used BluetoothAdapter before or it was null or something?
  • RafeeqRafeeq USMember ✭✭

    @ErikHa.5803 It Was Coming null value....

  • ErikHa.5803ErikHa.5803 VNMember ✭✭
    So it might be the fact that your device did not support bluetooth. Have you thought about this?
  • RafeeqRafeeq USMember ✭✭

    I am Connecting it with mobile(Lenova 6000) and running the app it will support the Bluetooth

  • ErikHa.5803ErikHa.5803 VNMember ✭✭
    Okay what about permission?
    Have you included BLUETOOTH permission in your app's manifest?
  • RafeeqRafeeq USMember ✭✭

    yes I have given BLUETOOTH,BLUETOOTHAdmin permission in My app's manifest.

  • ErikHa.5803ErikHa.5803 VNMember ✭✭
    That is odd. Try to run the app in different devives and see if it works.
    If the problem insists, can I have access to your project for a further examination?
  • DiogoLeaoDiogoLeao USMember ✭✭

    add ACCESS_COARSE_LOCATION permission too

Sign In or Register to comment.