NightscoutFoundation / xDrip

Nightscout version of xDrip+
https://jamorham.github.io/#xdrip-plus
GNU General Public License v3.0
1.49k stars 1.17k forks source link

Android 10 BLE + G6 - Stuck in "scanning" #1061

Closed nshtg closed 4 years ago

nshtg commented 5 years ago

I have a reproduceable problem with XDrip being stuck in Scanning.

1) Reboot the device on Android 10 2) Brain state is stuck in scanning

Solution: 1) Forget device in G5/G6 Status screen 2) Next cycle it sucessfully reconnects and works from that point on... Until I reboot again/or the transmitter fails to connect once because of range etc.

Oneplus 7 Pro on the official Android 10 Version. Newest XDrip Nightly from October 11.

17gubbar commented 5 years ago

Same problem

lkpod commented 5 years ago

Same problem.

nshtg commented 5 years ago

Does my fix ("Forget device" in System status screen of XDrip) work for you too? For me it's an 100% success rate so far!

17gubbar commented 5 years ago

It works, but i found a workaround for the problem now read #1067 :)

17gubbar commented 5 years ago

Also besure to turn of bt watchdog and untick the ob1 collector allowed to unbond.

ThoR294 commented 5 years ago

This did help, but mine keeps asking for calibrations right after I hit forget device. im on a pixel 4 xl.

ok, i think it FINALLY worked. it rejected my calibrations, then a few minutes later it says warming up

borijess commented 5 years ago

I have the same issue. OnePlus 7 pro on Android 10 beta 4.

borijess commented 5 years ago

Also besure to turn of bt watchdog and untick the ob1 collector allowed to unbond.

Can you post a pic of your settings here?

Screenshot_20191029-160131__01 Screenshot_20191029-160136

yumtime commented 5 years ago

Same issue with pixel 3 android 10. Getting this error:

Screenshot_20191101-151301

edisiENt commented 5 years ago

Same issues on OnePlus 7 Pro Android 10.0.1 with G6. Reverted phone back to Android 9.5 & saw good operation. OnePlus refreshed my BT firmware, returned to 10.0.1 and BT problems returned. Other BT devices (audio & car) work fine. XDrip to G6 is the only BT problem I'm seeing. G6 drops occur even while BT audio device is operating.

While phone is charging, link to G6 is solid & works all night. Within minutes of unplugging from power, Xdrip looses connection to G6 sensor.

nshtg commented 5 years ago

@edisiENt Have you tried forgetting the transmitter to see if it gets picked up again?

borijess commented 5 years ago

@edisiENt Have you tried forgetting the transmitter to see if it gets picked up again?

Yes I have but it works for alittle while the the same thing again

edisiENt commented 5 years ago

Yes. While on battery power, the only way I can get Xdrip to acquire new data from my G6 transmitter is to tell Xdrip to forget the device via SystemStatus, turn-off bluetooth manually, then Restart Collector. Frequently, multiple Restart Collectors are required but eventually Xdrip will read from my G6 transmitter.

I definitely have the opinion that Xdrip to G6 transmitter link is much more stable while the phone is connected to power/charging. This makes me wonder whether there is some new Android10 BT power state that Xdrip isn't dealing with correctly.

nshtg commented 5 years ago

@jamorham Any idea what may cause these problems on Android 10? As more and more providers push out Android 10 updates this becomes kind of an urgent probem.

jamorham commented 5 years ago

I don't know, there are often regressions in the Bluetooth stack with new android versions and manufacturer interpretations of those. I don't have any test devices which are using Android 10, what is the cheapest device on which these problems are reproducible?

borijess commented 5 years ago

I don't know, there are often regressions in the Bluetooth stack with new android versions and manufacturer interpretations of those. I don't have any test devices which are using Android 10, what is the cheapest device on which these problems are reproducible?

Maybe a OnePlus 6t. They just got Android 10 and you can get one for 300 dollars

edisiENt commented 5 years ago

I don't know, there are often regressions in the Bluetooth stack with new android versions and manufacturer interpretations of those. I don't have any test devices which are using Android 10, what is the cheapest device on which these problems are reproducible?

Is there anything we users with devices showing the problems can do to help you diagnose & resolve? Your having to purchase devices to replicate issues doesn't seem like a reasonable burden for you to carry. Could a nightly update have extra BT diagnostics or are there additional options in the existing logging capabilities?

nshtg commented 5 years ago

I second edisiENt's question. I can reproduce the problem 100% of the time by just going out of transmitter range once, should make debugging quite easy. Have 0 experience with android development but plenty c++/coding experience in general.

If you are located somewhere in europe I might be able to send you my backup phone to test with it.

borijess commented 5 years ago

I second edisiENt's question. I can reproduce the problem 100% of the time by just going out of transmitter range once, should make debugging quite easy. Have 0 experience with android development but plenty c++/coding experience in general.

If you are located somewhere in europe I might be able to send you my backup phone to test with it.

Same I can help too. Once out of range it doesn't want to reconnect.

jamorham commented 5 years ago

@nshtg If you keep the app open with the xDrip screen showing and then go out of range does the problem occur? You can use the Event Log screen to keep the phone constantly awake and in xDrip.

nshtg commented 5 years ago

@jamorham Yes, though this time I got stuck in "Connection request" instead of scanning. Normally my transmitter connects around x1:30 and x6:30'ish times. No errors logged in the event log. image001 image004 image005 image006 image007 image008

Keep in mind normally the connection request is send at around X1 minutes, so the "second" connection request is actually too late. After forgetting the device and restarting the collector it connected fine on the next cycle and started to work again.

BenMc19 commented 5 years ago

Just updated my OnePlus 6T and found this thread. Had to create an account to reply, but if I can help as well let me know. If not I'll be following closely.

As it seems quite a few of us use Pixel/OnePlus devices that will be getting early OS grades, we may can get 10 to 20 of us chip in $10 or so to buy a Pixel 3a as a reference device. It will get 3 years of guaranteed updates. I would gladly contribute $10-$20 every 3 years to help with this project.

borijess commented 5 years ago

Just updated my OnePlus 6T and found this thread. Had to create an account to reply, but if I can help as well let me know. If not I'll be following closely.

As it seems quite a few of us use Pixel/OnePlus devices that will be getting early OS grades, we may can get 10 to 20 of us chip in $10 or so to buy a Pixel 3a as a reference device. It will get 3 years of guaranteed updates. I would gladly contribute $10-$20 every 3 years to help with this project.

Same will donate.

nshtg commented 5 years ago

I'd donate $30 to that!

BenMc19 commented 5 years ago

Just an update, the solution that @Webifi posted in #1009 has worked for me. It involves forgetting the device in bluetooth settings and in xdrip app, and keeping both apps open in split screen as the phone scans for bluetooth devices and xdrip collector restarts and looks for device. Thought I would share if anyone here is still looking for a solution. I am on a OnePlus 6T running stable Android 10.

borijess commented 5 years ago

Just an update, the solution that @Webifi posted in #1009 has worked for me. It involves forgetting the device in bluetooth settings and in xdrip app, and keeping both apps open in split screen as the phone scans for bluetooth devices and xdrip collector restarts and looks for device. Thought I would share if anyone here is still looking for a solution. I am on a OnePlus 6T running stable Android 10.

I have the OnePlus 7 pro on Android 10 and still have issues. Can you post you exact instructions on how you did it? What are your Bluetooth settings? Can you walk away from phone and it will reconnect?

BenMc19 commented 5 years ago

@borijess

Well I literally just posted a response a few minutes ago. Same issue. Things will work great until it misses a reading. Every now and then it may regain signal, but most of the time it simply cannot regain it unless manually forgetting device and reconnecting.

Go to that link and check my latest post. I have an old android device that I tested with my same transmitter to confirm that it is the Android 10 update causing issues, not the transmitter itself.

BenMc19 commented 5 years ago

@borijess

Tried something after my last comment. I deleted the app completely (it was the latest stable version), and re-downloaded the November 2nd nightly version. Not sure if it was the fact that i deleted the app, or if something in the newer nightlies, but i haven't had any issues, and I have walked away a few times, forcing a missed reading, then it reconnected.

BenMc19 commented 5 years ago

@borijess

The author of that thread also confirmed he is running the latest nightly build, not the stable build. So that is 2 of us on Android 10, he on the Pixel and me on OnePlus, with good success. May want to give that a try.

Not sure what is being experimented with on the nightly, but feels and acts just as stable as the stable version. No issues with crashes at all.

misterblack1 commented 5 years ago

OnePlus 6 on Android 10 (updated last night) on the Nov 2 nightly with G6 and same issues as everyone else. Forgetting the transmitter will make it work a little while but then stops working.

Screenshot_20191109-084433

Seems to be stuck in scanning. It did connect while I was sleeping about an hour ago but looking at theogs I see it restarting the collector service many times throughout the night so clearly it wasn't staying connected consistently.

misterblack1 commented 5 years ago

I turned on some additional logging as requested in another thread:

Screenshot_20191109-093957

I forgot the transmitter and restarted collector. It worked for a while and then failed again.

misterblack1 commented 5 years ago

Screenshot_20191109-094805

Meant to attach this to previous post and it wouldn't let me add a picture while editing. More logs going back a little further showing when it stopped getting readings.

BenMc19 commented 5 years ago

Yeah, this was a major Android upgrade, probably going to take some time to figure it out. It works at long enough intervals without requiring a manual restart that that inconvenience still outweighs the inconvenience of carrying around the dexcom receiver. If it gets worse, I may elect to carry a second older Android phone as opposed to the dexcom receiver.

I wear a Wear OS watch daily, so i may also try to force Wear Collection as well. I just replaced my dying transmitter, so far on a fresh transmitter I'm going on 24 hours without any issues. We'll see.

Webifi commented 5 years ago

If you can't get x-drip going on android 10, you could also try side-loading the modified official dexcom app, instead of carrying around the receiver.

(I certainly prefer x-drip to Dexcom's app, but it did work for me in a pinch on my Pixel 3a when I was having trouble getting x-drip to work.)

@misterblack1 That transmitter battery is looking kinda long in the tooth.

misterblack1 commented 5 years ago

Interesting observation. Having zero issues while my phone is connected to my wireless headphones. Travelling today and I've noticed as long as BT is active there is zero issue connecting to the G6 transmitter. See the screenshot.

OnePlus 6 + G6 + Nightly Nov 2 + Android 10

Screenshot_20191109-180413

ElyeM commented 5 years ago

I upgraded to android 10 a few days ago, at first it did not connect at all, split screen with some changes mentioned here helped and I am now able to connect, but it constantly loses connection and i have to go in and do forgot device and restart collector.

Is there a way to automate this? whenever it fails to connect for 10 minutes it should automagically forget device and restart?

Using android 10 on OnePlus 6T

ElyeM commented 5 years ago

I upgraded to android 10 a few days ago, at first it did not connect at all, split screen with some changes mentioned here helped and I am now able to connect, but it constantly loses connection and i have to go in and do forgot device and restart collector.

Is there a way to automate this? whenever it fails to connect for 10 minutes it should automagically forget device and restart?

Using android 10 on OnePlus 6T

I have granted "Modify System Settings" permission to xdrip and It works great now.

misterblack1 commented 5 years ago

I have granted "Modify System Settings" permission to xdrip and It works great now.\

You likely have the "Bluetooth Watchdog" set which will reset bluetooth when it's not getting readings for 20 minutes. (Settings -> Less Common -> Bluetooth) Can you confirm?

This isn't workable for anyone who uses their bluetooth for headsets, streaming music, etc.... as it interrupts those. It also will almost certainly increase battery drain on your phone.

misterblack1 commented 5 years ago

I find that xDrip seems to reconnect on it's own from time to time which means almost always the reading history is downloaded from the transmitter. (Meaning no gaps.) It just means alerting is useless because it's almost always not getting data regularly.... unless I am using my Bluetooth 5.0 headphones (Wireless Bullets 2) then xDrip+ stays connected indefinitely. (It takes maybe 20-30 minutes before xDrip reconnects to the transmitter then it stays connected. )

For me, I don't need to go and forget the transmitter -- it will just periodically connect on its own. Losing alerts really does suck though........

Incidentally, my Xiaomi fitness watch which is uses BLE has no issue staying connected to my phone after the Android 10 update.

nshtg commented 5 years ago

I have granted "Modify System Settings" permission to xdrip and It works great now.\

You likely have the "Bluetooth Watchdog" set which will reset bluetooth when it's not getting readings for 20 minutes. (Settings -> Less Common -> Bluetooth) Can you confirm?

That is not the case. I don't use the watchdog and need the permission to use XDrip at all.

misterblack1 commented 5 years ago

I have granted "Modify System Settings" permission to xdrip and It works great now.\ That is not the case. I don't use the watchdog and need the permission to use XDrip at all.

I've always had that setting enabled, but like everyone else, it's very intermittent and always stuck in scanning.

Screenshot_20191118-115619 Screenshot_20191118-115654 Screenshot_20191118-115659

borijess commented 5 years ago

I granted that permission too and it was more miss than hit. Still disconnected a ton.

BenMc19 commented 5 years ago

Yeah, same here. Seems about 2 or 3 times a day I have to forget and reconnect. Although inconvenient, still worth going through the hassle to use xDrip on phone than the Dexcom receiver. Hopefully with more phones getting Android 10 it'll get fixed.

ElyeM commented 5 years ago

I take back my last comment that modify system settings fixed the issue, I still constantly loose readings and have to click forget device and restart collector.

borijess commented 5 years ago

I take back my last comment that modify system settings fixed the issue, I still constantly loose readings and have to click forget device and restart collector.

Same.

MasterPlexus commented 5 years ago

I take back my last comment that modify system settings fixed the issue, I still constantly loose readings and have to click forget device and restart collector.

Just to try, if you have a Fitbit app in use on the phone. If yes, try to deinstall it, and check if that betters the Situation without that app. (I think we shortly talked about that in the gitter Channel, but I'm not sure)

ElyeM commented 5 years ago

I don't have the Fitbit app.

jamorham commented 5 years ago

The reported problems, eg Android 10 not reconnecting after a period of time may be google brutalizing developers again with changes to the permissions model in Android 10.

Can anyone with this problem please try the Nov 22 nightly and see if it helps at all. Please also visit the settings page at least once to see if it requests any additional permissions. Thanks.

I don't yet have an Android 10 physical handset to test with so I am only guessing at a resolution as I haven't been able to reproduce it myself and have been receiving conflicting bug reports.

borijess commented 5 years ago

The reported problems, eg Android 10 not reconnecting after a period of time may be google brutalizing developers again with changes to the permissions model in Android 10.

Can anyone with this problem please try the Nov 22 nightly and see if it helps at all. Please also visit the settings page at least once to see if it requests any additional permissions. Thanks.

I don't yet have an Android 10 physical handset to test with so I am only guessing at a resolution as I haven't been able to reproduce it myself and have been receiving conflicting bug reports.

Trying it now. Had to accept the permissions in settings and had to do a forget and restart collector. So far working. Real test is walking away for a while to see if it reconnects. I will let u know and thank you for time and effort resolving this.

borijess commented 5 years ago

The reported problems, eg Android 10 not reconnecting after a period of time may be google brutalizing developers again with changes to the permissions model in Android 10.

Can anyone with this problem please try the Nov 22 nightly and see if it helps at all. Please also visit the settings page at least once to see if it requests any additional permissions. Thanks.

I don't yet have an Android 10 physical handset to test with so I am only guessing at a resolution as I haven't been able to reproduce it myself and have been receiving conflicting bug reports.

Ok I tried it and walked away for 10 minutes. It has not reconnected after 50 minutes. I had to forget and restart collector.