Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Clear Android Bluetooth cache
Forum Updated to NodeBB v4.3 + New Features

Clear Android Bluetooth cache

Scheduled Pinned Locked Moved Mobile and Embedded
bluetooth low ebluetoothandroid
2 Posts 2 Posters 2.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JRoorda
    wrote on last edited by
    #1

    Hi,

    I'm using the Qt Bluetooh Low Energy API to read a BLE sensor. Since the sensor dynamically updates and adds services, the Android Bluetooth cache needs to be cleared or refreshed in order to read the new added services.

    For the people that dont know about this: Android caches bluetooth devices. This means that if the cache data is not refreshed the application will read old data from cache instead of new retrieved information.

    The Qt documentation says this about the problem:
    "Note: Some platforms internally cache the service list of a device which was discovered in the past. This can be problematic if the remote device changed its list of services or their inclusion tree. If this behavior is a problem, the best workaround is to temporarily turn Bluetooth off. This causes a reset of the cache data. Currently Android exhibits such a cache behavior."

    At the moment I'm using the workaround to clear the cache data, but this is a very ugly way to do so. Is there any other way to do this without using the AndroidExtras lib that Qt provides?
    If there isn't, I'd like to add a ticket or something, but I dont know how to do that.

    Thanks in advance,
    J. Roorda

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kuzulis
      Qt Champions 2020
      wrote on last edited by
      #2

      Maybe you should just do bluetooth turn off/on programmaticaly from your app, before using of an BLE.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved