-1

i am trying to do the new implementation (the classic discovery doues not work anymore in Android 6.0 and above) for scan devices as described at the developer guide Marshmallow changes:

Also i did as described in other thred

And this one

My issue is that the onScanResult from ScanCallback is never reached

Ajeet Choudhary
  • 1,969
  • 1
  • 17
  • 41
Billyjoker
  • 729
  • 1
  • 10
  • 31
  • -1 why? I'm working with this issue since some days, i've cited references from other posts and android developer official guide. There's no existing full code implementation of Bluetooth LE (not old 2.0) for take some reference, only snippets... – Billyjoker Jun 23 '17 at 09:46

1 Answers1

0
  1. Bluetooth adapter may be enabled.
  2. Bluetooth usage permissions may be granted (At runtime or not).
  3. Location permission (ACCESS_COARSE or ACCESS_FINE) may be granted to be able to retrieve scan results.
  4. Make sure gps provider is enabled (Smartphone GPS settings).
  • About #4 i've read about you have to enable "Location" (GPS) in the settings of the phone as well as request location permission in the app at runtime, so did you? https://issuetracker.google.com/issues/37065090 – Billyjoker Jun 23 '17 at 12:51
  • Yes, you need both. – Alexandre BOURETZ Jun 26 '17 at 06:25
  • Many thanks, i've got the scanResult callback get called and i can list some devices, but there is no the device i wanted like other mobile phones, how could i discover the missing bluetooth devices? – Billyjoker Jun 26 '17 at 06:49
  • If you're scanning specific UUIDs make sure your device advertises with the good UUID. You can find somme docs if you google it. – Alexandre BOURETZ Jun 26 '17 at 07:14
  • Ok, i understand it. Although i thought that i could discover the same devices as if i go to settings -> bluetooth -> scan with my phone. Indeed with an older device prelollypop i can discover the devices i wait to get (using the old method of discovering). I'd like to perform in the same way to discover the same devices, – Billyjoker Jun 26 '17 at 07:42