Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracing is unreliable once the phone is in your pocket #31

Open
acooley opened this issue Apr 29, 2020 · 3 comments
Open

Tracing is unreliable once the phone is in your pocket #31

acooley opened this issue Apr 29, 2020 · 3 comments

Comments

@acooley
Copy link

acooley commented Apr 29, 2020

Ok, so my apologies if this is not correct, I have not yet read all of your code BUT...

Based on my quick look at your manifest and what I saw with setting up background tasks I don't think you will be able to get the Android version of your application to scan consistently. When Android puts the app into Doze mode your alarm manager won't wake up the app to scan. You can fix that and you can scan at any frequency you want using Alarm Manager even when the application has been killed or the handset has been 'Dozed'. Here's the basics:

add.. to your manifest.

Don't use Alarm manager to schedule a repeating task. Instead, use it to schedule one task at a time with a delay, BUT in the task, schedule the next task. Also in the broadcast receiver you'll need to take the wake lock. I'm going to take a more careful look at your code later today. Please let me know if you would like help fixing this; I've already implemented it this way in our social distance app and it will work here too.

--aaron

@puneetkumar1011
Copy link

Hi,

I am using this code base for my demo app but as soon as the Screen is locked after some time BLE scan stops working there is no advertising and scanning of nearby devices.

In case if I am using the BLE scan and advertising continuously then it works properly. Most of Samsung devices it gives the problem.
I have tried by adding Scan filters and whitelist my app but nothing works when the screen is lock/OFF.

Thank you
Puneet

@NKGodhan
Copy link

NKGodhan commented Jul 8, 2020

Hello,

Want to increase the counter here on the board.

I am building an app to trace data of my surrounding devices (using my app). I am following the same code base, but facing the same issue regarding the BLE devices scan and advertisement when a device goes in the sleep mode OR got locked using the power button.

I checked the same scenario in multiple devices but the result is same, it is unable to scan device advertising data at all. The devices I am testing with are mostly premium devices like Samsung, OnePlus, Motorola etc. I tried most of the methods (as they exists on the web) to resolve the issue, but nothing was good enough.

I am not sure what causing such behavior but please provide a proper solution to fix it if it exists.

Thanks,
Nikhil Godhan

@xonack
Copy link

xonack commented Aug 25, 2020

bumping the thread to see if there have been any developments.

@acooley Sounds like a great fix!! Is the alarm manager functionality you are describing all in the manifest? or are other files involved as well?

cheers,
honack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants