I'm currently having issues with Samsung Devices running Android Pie.
My App is using a foreground service with an active notification. Once a geofence is entered I'm scanning for a bluetooth beacon.
This works on all devices across all Android versions (also used to work on Samsung devices running oreo).
The problem begins after entering the geofence.
It seems like the system prevents the bluetooth scan from starting as long as the display is black.
Once I press the power button (without unlocking or even opening the app) I see the scan results coming in.
I'm already using scan filters since this led to the same problem on all android devices after updating to oreo.
Has anybody experienced the same issue or could point me in the right direction?
Kind regards
Related
Came across a problem that sometimes BluetoothLeScanner can't detect anything for about 10 or 20 seconds.
(this problem can be reproduced by running the below code multiple times, scanner will not work for a while)
bluetoothAdapter.getBluetoothLeScanner().stopScan(mScanCallback);
bluetoothAdapter.getBluetoothLeScanner().startScan(mScanCallback);
I tried to restart BluetoothLeScanner programmatically and manually turn on and off wifi + Bluetooth but it did not work, always need to wait 10 sec or so until the system detect the BLE signals.
I ended up turning airplane mode on and off, and everything works perfectly (works every time), I don't need to wait, just turn it on and off, and the system will detect the BLE signal.
What I'm trying to do is, make a button, when I click on it, the app will turn airplane mode on and off, but this seems not doable for Android 4.2 later version. Is there any way I can reproduce a similar function that works like airplane mode? (maybe be clear some cache?)
Unfortunately turning on/off Airplan mode on Android v4.2 is not supported. Have a look at the links below:-
https://developer.android.com/about/versions/android-4.2.html
How to programmatically enable/disable flight mode
Programmatically setting ON/OFF airplane mode
Is there any reason for using Android 4.2? It is a very outdated OS (10 years old) and Android has improved vastly since then especially when it comes to BLE API and functionality. If you have the option of upgrading to a newer OS, I would recommend that you start with this as your first priority.
If upgrading to a newer OS is not an option, then I would personally try to fix the actual problem instead of finding a workaround. One possibility of this happening is that you are scanning too often, which can sometimes result in no scan results being returned for about 30 seconds. This is a tricky one as the Android OS doesn't return an error - it just doesn't return any results which seems to be similar to what you are seeing. Have a look at this link and search for the string "notable scan errors". I would also look at the Logcat log as you can sometimes find more info there.
Finally, it is possible that this is somehow a problem with the hardware (especially if it is an old device). Try installing nRF Connect and scanning for BLE devices. If the issue exists over there as well, then that proves that it's a hardware/device problem. If the issue doesn't exist over there, then this is a problem with your app.
I am using my Android phone as a receiver for a Bluetooth sensor located on the room. I am struggling in solving an issue, whenever I leave the phone unattended (I am sleeping), the app keeps logging information for some time but then everything is stopped and only starts working if I start the app again.
My device is a Samsung Galaxy S7, but this has happened across many manufacturers and models.
I'm currently trying to use a smartwatch LG G Watch R (fully updated) as a Beacon Scanner.
The Beacons are made by Estimote, so I'm using its SDK.
Using the smartphone I have no problem at all, but with the smartwatch I receive the signal from the beacons every 5 seconds despite having set both on the app and on the beacons the advertising time at 325ms.
The code is basically the same used on the smartphone.
Any ideas?
I don't know about the LG watch, but I realized similar behavior with other devices, like the Moto G2 for example. Even though the code is exactly the same, different devices handle it differently. It might be due to different chipsets used or how they are implemented.
Go to the logcat (without filtering the app) and look at the times when scans are started, stopped and when results are received. You might see that the scan process makes random "breaks" for no visible reason. Maybe it's the same issue with your watch.
Unfortunately I don't know about a solution.
Overview:
We have developed an app that allows customers check in using an NFC enabled card with a stationary Nexus S. The app sit ready to read a card, when a card is tapped, the app reads the unique ID for the NFC card.
Problem:
The challenge we have run into, is that the Nexus S locks up after scanning 50 to 100 tags. The app continues to function, and so does android, however neither our app, or the native app within android will read a tag. It is as though the scanner has been disabled. I have tested it using 4 different Nexus S devices running Android 2.3.6.
Debugging:
The only solution I have been able to find is to either:
- power the nexus s off and then power it back on
- disable NFC and then re-enable it through Setting --> Wireless & network settings --> NFC
If either of those are done, the scanner works again and app continues to work as normal until it locks up again after 70 or so scans.
Any idea how to fix this bug, or work around the issue?
Update: it appears as though this is not just with our app, testing the "Tags" native app that comes with the Nexus S also has this issue.
We have experienced the same issue with our NFC apps. Seems to be a hardware issue. We have done the same thing you are doing by re-enabling NFC in settings.
Unfortunately I don't think it's your problem so you may have to report the issue directly to Samsung or Google via Samsung Tech Support or a Google Android bug report.
Another thing to do is to see how the tag recognition works with the new Galaxy Nexus when it gets released in the next 2 weeks.
I have 2 applications w/ the bluetooth code derived from the Bluetooth Chat sample. Individually they work fine. Each app connects via SPP to separate devices. The issue I'm having is on phones with Android 2.1, after the first app connects to its device, you can press Home and get to running the other app, but as soon as the connection is made to the other device with this other app, both apps get the "Sorry! The application xyz (process com.xyz) has stopped unexpectedly. FORCE CLOSE" dialogs. There are try/catch blocks throughout the bt code, for which the catches are not executed. Neither app will then connect (individually) until after bluetooth is turned off then on again. This does NOT happen when these same apps are running on a Samsung tab with Android 2.2 - both apps can run and connect to the devices simultaneously just fine and you can switch between the apps, no problems.
Is this specifically an Android 2.1 issue or something else? Whether it is or not, I need some way to prevent the app from connecting if another app is using bluetooth. I couldn't find anything in the Android APIs that would allow finding this out. Is there any way to coordinate/manage this? Does anyone have any specific insights into this whole issue?
I think it is a bug in the samsung bluetooth stack.
upgrading the my samsung to cyanogenmod fixes it.
see this link
http://www.samsunggalaxysforum.com/firmware-problems/connection-problems-sgs-bluetooth-spp-device/