Android Question BLE usage and GPS device enabling with Android 9

elpic76

Member
Licensed User
Longtime User
Dear Sirs,
after the upgrade to Android 9 I'm a problem with an app that worked very well before.
The app uses BLE communication accordingly to the thread BLE 2 - Bluetooth Low Energy
with information from post #1:

A new version of BLE_Example was uploaded. targetSdkVersion is now set to 26.
Setting the targetSdkVersion to 26 requires some changes:

1. Add the coarse location permission in the manifest editor.
2. Request this permission with RuntimePermissions.

The device used is a Samsung Galaxy S8+ below you'll find device info after the upgrade:
Info_S8+.jpg

Now the BLE scan and communication is available only if the user enable GPS device.

I tried with:
  • only coarse location permission enabled
  • only fine location permission enabled
  • both coarse and fine location permission enabled
without any improvement.
So is it possible to use BLE without enabling GPS or must I use some "permission wizardry" to solve the problem?
Best Regards
 

walterf25

Expert
Licensed User
Longtime User
Dear Sirs,
after the upgrade to Android 9 I'm a problem with an app that worked very well before.
The app uses BLE communication accordingly to the thread BLE 2 - Bluetooth Low Energy
with information from post #1:

A new version of BLE_Example was uploaded. targetSdkVersion is now set to 26.
Setting the targetSdkVersion to 26 requires some changes:

1. Add the coarse location permission in the manifest editor.
2. Request this permission with RuntimePermissions.

The device used is a Samsung Galaxy S8+ below you'll find device info after the upgrade:
View attachment 79044

Now the BLE scan and communication is available only if the user enable GPS device.

I tried with:
  • only coarse location permission enabled
  • only fine location permission enabled
  • both coarse and fine location permission enabled
without any improvement.
So is it possible to use BLE without enabling GPS or must I use some "permission wizardry" to solve the problem?
Best Regards
I think there is something wrong in your project, BLE works independently from GPS, it helps if you upload a small project at least with the relevant pieces of code and the manifest xml file to see which permissions are being added.

Regards,
Walter
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
i can agree that the ble did only work if me enable also the location service at phone (android 8.1). why - i don't know.
i used the arduino with a bluetooth modul + phone app made in b4a.
 
Upvote 0

emexes

Expert
Licensed User
BLE works independently from GPS
At least, that's how it's supposed to be, but...

I had some devices where BLE only worked if wifi was also running. All worked great during development (compiling to release mode), but continuously failed in the field. Turned out that B4ABridge was keeping the wifi alive; when wifi went quiet, Android's powersave would shut it down, and turns out this was shutting down the BLE transceiver as well. It wouldn't surprise me to find that the GPS receiver is part of an all-in-one radio solution module, and that it is somehow affecting the Bluetooth transceiver.
 
Upvote 0

elpic76

Member
Licensed User
Longtime User
Good morning, I tested the app combining 3 different versions based on the enabled permission: coarse location, fine location and both of them.
Then I tested all the 8 combination with: WiFi ON and OFF, GPS ON and OFF and 4G ON and OFF.
In all the 24 tests the app runs ok (BLE scan ok, connection ok and data RX TX ok) only when the GPS is ON regardless the enabled permission.
So from the tests it results the GPS must be enabled to make the BLE work on Android 9.
I'll do more tests using another device with a lower Android version to catch the differences and compare the results.
Now I would try to use the fused location library but I'm having problems infact an error occurred: Maven artifact not found: com.google.android.gms/play-services-location.
But I open a new thread for this issue.
Regards.
 
Upvote 0

elpic76

Member
Licensed User
Longtime User
Hello,
I completed the test on an Honor with Android 7 with the same approach used to test the Android 9 device, the BLE always works.
Moreover I removed the SIM card and in Android 7 the BLE works, while in Android 9 it works only if the GPS is enabled.
Android 9 seems to have many problems with BLE infact I found this:
https://stackoverflow.com/questions...fter-update-android-studio-and-or-upgrade-tar

in particular the last message isn't so encouraging:
Pie has BLE and BT issues: see productforums.google.com/forum/#!topic/phone-by-google/… or community.fitbit.com/t5/Android-App/…

I hope Google will clarify the issue, for now I'll enable the GPS too.
Best Regards
 
Upvote 0
Top