traccar-client-android icon indicating copy to clipboard operation
traccar-client-android copied to clipboard

[v5.17] Issue #367 (not sending location updates) is not fixed

Open oliv3 opened this issue 6 years ago • 29 comments

Just tested v5.17 and confirm that sending locations only works when:

  1. GPS is turned ON: it still doesn't work when using mobile network, wifi or bluetooth.
  2. Accuracy is set to High. Medium and Low settings, even with GPS turned ON, result in no locations being sent.

oliv3 avatar Jan 07 '19 16:01 oliv3

Issue #367.

oliv3 avatar Jan 07 '19 16:01 oliv3

Which version have you tested? APK or one from Google Play?

tananaev avatar Jan 07 '19 17:01 tananaev

same for me using the APK from f-droid (no google play on my devices)

landryb avatar Jan 07 '19 19:01 landryb

There are no changes if you are using APK. The idea is to use Google location provider if it's available, but on f-droid we still use standard Android location APIs.

tananaev avatar Jan 07 '19 19:01 tananaev

@tananaev I used the one from Google

oliv3 avatar Jan 07 '19 23:01 oliv3

Just tested:

  • Accuracy high - no GPS signal - works
  • Accuracy medium - works
  • Accuracy low - works

What exactly is not working?

tananaev avatar Jan 08 '19 02:01 tananaev

Hi @tananaev, here's the report:

Brand / model: Sony / Xperia X Compact

OS: Android / 8.0.0

Client: 5.17

Flavor:

  • [x] Google Play store
  • [ ] F-Droid
  • [ ] Other APK:

Phone settings:

  1. High accuracy: GPS, mobile network, Wi-Fi and Bluetooth
  2. Battery saving: Mobile network, Wi-Fi and Bluetooth
  3. GPS only (one can expect the same results as 1.)

Traccar settings:

  1. High
  2. Medium
  3. Low

Results:

  High Medium Low
Phone: High accuracy :heavy_check_mark: :x: :heavy_check_mark:
Battery saving :x: :x: :x:
GPS only :heavy_check_mark: :x: :heavy_check_mark:

Additional notes:

Tests were run in the open-air, device in motion with settings:

  • Update frequency: 1s
  • Minimal distance: 0
  • Minimal angle: 0

oliv3 avatar Jan 15 '19 12:01 oliv3

Have you enabled network location provider on your phone? When you first set up your phone, it asks you if you consent to it.

I have tested all 3 modes with high accuracy (Android settings) and all of them work fine.

tananaev avatar Jan 15 '19 18:01 tananaev

I don't see any option to enable/disable network location provider, so I'd say it is enabled. Also, have never been asked (even on first set up) if I would want to disable it, and have no reason for doing so. In the past (v5.12 IIRC) it worked.

oliv3 avatar Jan 15 '19 19:01 oliv3

Simply put, it doesn't work anymore for all versions later than removal of Lost API.

oliv3 avatar Jan 15 '19 20:01 oliv3

Every Android phone I ever had asked consent for using network location. If you don't enable it during setup, I'm not sure if there is a way to enable it later.

tananaev avatar Jan 15 '19 20:01 tananaev

Don't see why I would have disabled it. What was the last version using Lost API ?

oliv3 avatar Jan 15 '19 20:01 oliv3

Don't remember now. Check git log on the gradle file to see when it was removed.

tananaev avatar Jan 15 '19 21:01 tananaev

Looks like it was removed in 5.12, so I'd need to test 5.11 again. Unfortunately the release asset from github won't install.

oliv3 avatar Jan 15 '19 21:01 oliv3

What is the error? It should install just fine. Make sure you remove the app first, if you already have it installed.

tananaev avatar Jan 15 '19 21:01 tananaev

I uninstalled it first.

oliv3 avatar Jan 15 '19 21:01 oliv3

Sorry for jumping in, but I have to agree with @oliv3 v5.17 is not working. Previous version(s) worked fine. Unfortunately all my clients updated automatically to this version.

After playing around with it for the last hours I found this thread and tried changing accuracy to high - and here we go, client sends as expected. If I could help with debugging, testing or whatever - I'll be there...

normic avatar Jan 21 '19 18:01 normic

Try to get system logs. On my Pixel 3 XL all accuracy options work just fine without any issues.

tananaev avatar Jan 21 '19 18:01 tananaev

thanks for your quick reply and sorry for my late one, was quite busy today. I just connected my PRIV but cannot find any logs for traccar - do you have an idea where I can find them?

normic avatar Jan 22 '19 17:01 normic

What is PRIV? You need to use ADB to extract logs from Android device.

tananaev avatar Jan 22 '19 17:01 tananaev

Blackberry PRIV (running Android 6.0.1), I'll check that with ADB, but will be earliest on Thursday. I'll mention my results here...

normic avatar Jan 22 '19 18:01 normic

@normic, @landryb: Feel free to report what's not working using this repository. Just send a PR or open an issue so that I can update it accordingly.

@tananaev: FWIW, I'm also using Nextcloud PhoneTrack, which works for me with "Network only" setting.

From your comments, I read that Traccar client works well if and only if you are using:

  • a Google-based OS
  • with Google Services enabled
  • on a Google-made phone

Or did I miss something ?

oliv3 avatar Jan 22 '19 20:01 oliv3

I only have Google phone at the moment, so I haven't tested on anything else. I have tested on emulator, but it only supports GPS location.

tananaev avatar Jan 22 '19 20:01 tananaev

Hello @oliv3 @tananaev

I would like to draw your intention on following limits imposed by Android OS itself on every devices starting from Android Oreo and above.

Background Execution Limits

Background Service Limitations: While an app is idle, there are limits to its use of background services. This does not apply to foreground services, which are more noticeable to the user.

Broadcast Limitations: With limited exceptions, apps cannot use their manifest to register for implicit broadcasts. They can still register for these broadcasts at runtime, and they can use the manifest to register for explicit broadcasts targeted specifically at their app.

Background Location Limits

In an effort to reduce power consumption, Android 8.0 (API level 26) limits how frequently background apps can retrieve the user's current location. Apps can receive location updates only a few times each hour.

I want you guys to consider Schedule tasks with WorkManager

The WorkManager API makes it easy to schedule deferrable, asynchronous tasks that are expected to run even if the app exits or device restarts.

Key features:

Backwards compatible up to API 14
    Uses JobScheduler on devices with API 23+
    Uses a combination of BroadcastReceiver + AlarmManager on devices with API 14-22
Add work constraints like network availability or battery
Schedule asynchronous one-off or periodic tasks
Monitor and manage scheduled tasks
Chain tasks together
Guarantees task execution, even if the app or device restarts

I have notice we are [in this repository] using BroadcastReceiver + AlarmManager explicitly in our code. It's worth considering to use WorkManager API for location tracking.

I want your feedback / thoughts on this approach for supporting new devices which are yet to come.

Related links.

  • https://stackoverflow.com/questions/53064077/android-oreo-and-above-whats-the-best-way-to-get-location-when-app-is-not-runni
  • Guide to background processing

Thanks

kasim1011 avatar Feb 23 '19 16:02 kasim1011

@kasim1011, I would like to draw your attention to the following sentence that you quoted:

This does not apply to foreground services, which are more noticeable to the user.

Which basically makes rest of your comment irrelevant to the situation with Traccar Client.

tananaev avatar Feb 23 '19 17:02 tananaev

Traccar Client uses foreground service mode with a notification that is visible to the user.

tananaev avatar Feb 23 '19 18:02 tananaev

I have exact the same problem with my Samsung S2, in the past it worked fine, but for a few weeks it doesnt send "position update", in the log it only shows " network online", thats it. After reading this, and changing accuracy to "high" its sending now again. With a newer phone e.g. Samsung A5 there was no problem!

herbstfuerst avatar Apr 29 '19 13:04 herbstfuerst

I have exact the same problem with my Samsung S2, in the past it worked fine, but for a few weeks it doesnt send "position update", in the log it only shows " network online", thats it. After reading this, and changing accuracy to "high" its sending now again. With a newer phone e.g. Samsung A5 there was no problem!

I have to correct me, its still showing, that Traccar is online, but doesnt send GPS datas to Server. With newer Android Phone its not a problem.....

herbstfuerst avatar Apr 30 '19 08:04 herbstfuerst

This happened to me on a Huawei device and it happened to be Privacy Guard. Took me a while to figure it out. Coarse Location was set to "Always Ask" but there was no prompt in the phone. Changing to allowed fixed the issue. This is beside the point of Allowing location request when starting the app. (Yes it was allowed)

SaJeTek-Developer avatar Jun 04 '19 18:06 SaJeTek-Developer