Git Product home page Git Product logo

Comments (17)

mathisdt avatar mathisdt commented on July 28, 2024

Could you please try to disable the battery optimization for TWT in the settings? Maybe Android causes the IN/OUT events by manipulating the app for power saving.

These screenshots may help you get to the right place (sadly the option is not very obvious):
screenshot 1
screenshot 2
screenshot 3
screenshot 4
screenshot 5
screenshot 6
screenshot 7

from trackworktime.

berceanu avatar berceanu commented on July 28, 2024

Thank you, I followed the instructions in the screenshots but unfortunately the problem persists. Here is a screenshot showing the events for today.

screenshot jan 12 2018 12_48_36 pm

from trackworktime.

mathisdt avatar mathisdt commented on July 28, 2024

It seems that Android Oreo creates some extra work for developers of location-aware apps which are not in the foreground all the time - see https://developer.android.com/about/versions/oreo/background-location-limits.html

I honestly don't know when I will have the time to look into this new behaviour of Android.

from trackworktime.

mathisdt avatar mathisdt commented on July 28, 2024

@PRosenb, do you know how to get around this obstacle?

from trackworktime.

PRosenb avatar PRosenb commented on July 28, 2024

@mathisdt, I see this issue on my device too and will do some tests to find out if it can be resolved without too much effort.

from trackworktime.

mathisdt avatar mathisdt commented on July 28, 2024

@berceanu: I should have resolved this issue with the fix for #37. Could you please re-test using the newly released version 1.0.3?

from trackworktime.

WildOrangutan avatar WildOrangutan commented on July 28, 2024

This issue still persists in 1.0.3

from trackworktime.

WildOrangutan avatar WildOrangutan commented on July 28, 2024

Something that may help you to figure out what's going on. I'll try to fiddle around a bit, but can't make any promises.

Reproduce

  • emulator API 26 (or later, dunno I've used this one)
  1. Start the app and set it up
  2. Press power button (Ctrl+P) to put it to ?sleep? mode
  3. Should start disconnecting every few minutes

Logcat

from trackworktime.

mathisdt avatar mathisdt commented on July 28, 2024

Using your description I finally could observe the problem myself (log). This is good - but I'm still not sure when I will have the time to fix it.

It looks like Doze or App Standy (which seems to have changed in 8.0) is the cause of this issue, especially because it only kicks in after some time of inactivity. Also see #11.

from trackworktime.

WildOrangutan avatar WildOrangutan commented on July 28, 2024

Just fyi, I'm cooking up a fix for this issue. Basically using this implementation seems to solve this problem. Checking WifiManager.startScan() return value and more importantly WifiManager.EXTRA_RESULTS_UPDATED and only then checking WifiManager.getScanResults() does the job.

from trackworktime.

WildOrangutan avatar WildOrangutan commented on July 28, 2024

@mathisdt Let me know what you think about my fix 21615f3 . I've been testing it on my phone for about a week without any issues.

If you want, I can also include basic functional tests for new functionality. I've played around a bit and almost have them made in Mockito + Junit4.

from trackworktime.

mathisdt avatar mathisdt commented on July 28, 2024

@WildOrangutan Great to hear of your progress! I have two questions about your change:

  1. Major: Could it be done without requiring CHANGE_WIFI_STATE permission? Requesting this might be seen as intrusive, so if possible, I'd very much like to go without it.
  2. Minor: Can we please (a) use blocks in if-else statements to ensure consistency and (b) remove prefixes like "m" from instance variable names? (I know, then we have to use a "this." qualifier to address the right variable, but for my understanding prefixes make the code more difficult to read.)

from trackworktime.

WildOrangutan avatar WildOrangutan commented on July 28, 2024
  1. Hm, looking at documentation I've linked above, it could be done w/o including CHANGE_WIFI_STATE permission, but only on Oreo devices. Starting with Android Pie, it's required, along with some additional stuff. Dunno why I included this now; I'm intending of doing some minor fix on for Pie. I can exclude this for now.

  2. Sure, no problem.

from trackworktime.

WildOrangutan avatar WildOrangutan commented on July 28, 2024

Even tough documentation says otherwise, CHANGE_WIFI_STATE is a must have. I'd say due to build tools version already on 28. App crashes otherwise.

from trackworktime.

WildOrangutan avatar WildOrangutan commented on July 28, 2024

One more idea on permission thingy (sorry for spamming). If you really want to avoid it, I guess you could omit wifiManager.startScan() and only listen when scan results update. Similarly like it's working on master atm. Tough relying only on other services to initiate scans is a bit optimistic imho.

from trackworktime.

WildOrangutan avatar WildOrangutan commented on July 28, 2024

@mathisdt I suggest closing this (and possibly similar) issues. Last fix seems to be working reliably for me.

from trackworktime.

mathisdt avatar mathisdt commented on July 28, 2024

Thanks @WildOrangutan. Seems to work. 😃

from trackworktime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.