Android Question BLE2 + BluetoothAdmin

Discussion in 'Android Questions' started by Josias, Jul 16, 2018.

Thread Status:
Not open for further replies.
  1. Josias

    Josias Member Licensed User

    I am using Ble2 library to connect to my device. No problem. Enhancing my program I decided to change the program such that when the user opens my program it should automatically enable the BT adaptor if not enabled and start a scan for BLE devices.
    I am using both the BLE2 library and BluetoothAdmin. BluetoothAdmin is used to enable the adaptor and Ble2 is used for Tx/RX. Both libraries have got a 'StateChanged' event. It seems that two libraries are not playing nice together. Is there a way not to use BluetoothAdmin and to enable the BT adaptor or what are my options?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Have you set the event name to a different value (when you initialize the relevant object)?
     
  3. Josias

    Josias Member Licensed User

    THe majority of my code is snippets that I got from the various examples on the forum.

    Public manager As BleManager2
    Public admin As BluetoothAdmin

    admin.Initialize("admin")
    manager.Initialize("manager")
     
  4. Josias

    Josias Member Licensed User

    Should the name be the same or different? What effect does it have?
    What should be initialized first? manager or admin? Does it make a difference?
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    It should be different. What exactly happens when it is not working properly?
     
  6. Josias

    Josias Member Licensed User

    It seems to loose synchronization. The one will report that Bluetooth is off and the other will report that it is on.
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    Can you upload a small example that reproduces it?
     
  8. Josias

    Josias Member Licensed User

    It seems that my understanding of the libraries is not complete.
    It seems that I am fighting something that is happening in the background as I was trying to enable the BT adaptor myself if it is not enabled. But it seems that something else is trying to enable the BT adaptor every 60 seconds. Can it be BleManager2 that is doing it? I've disabled BluetoothAdmin. If BleManager2 is trying to enable BT, what is the reason and what is trying to achieve?
     
  9. Erel

    Erel Administrator Staff Member Licensed User

    BleManager2 doesn't enable the adapter.
     
  10. PeterPaulGumpal

    PeterPaulGumpal Member Licensed User

    I can't find BleManager2 from the B4A Library, could some provide instruction please.
     
  11. DonManfred

    DonManfred Expert Licensed User

  12. Erel

    Erel Administrator Staff Member Licensed User

    You should never post in existing threads.
     
Thread Status:
Not open for further replies.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice