Androids Network Position Provider on some phones not working

Martin7 years ago

Hi Anton,

during my tests with some android devices I found two (Honor 7 & Lenovo K6) where the Network Location is not working in traccar, but generally working. So when I am limiting the location provider in the android settings to wlan and network, other apps like google maps and others can display my position (with deactivated wlan it has to come from the network), but traccar sends no position. Traccar only sends positions with activated gps and leaving the house on those phones. On others it works normally (also sending positions without gps fix).
I am wondering, if you could investigate this a little bit: by googling i found, that there is another api to get the location: the Android Location Service API, as well as the Fused Location Provider available with the Google Location Services API.

https://developer.xamarin.com/guides/android/platform_features/maps_and_location/location/#Get_Location_with_Google_Location_Services_and_the_Fused_Location_Provider

Anton Tananaev7 years ago

Which location provider have you configured in the app?

Martin7 years ago

I am using the mixed provider. In this case, like I described, I get only positions from GPS or no position. Traccar then shows me as notification, that it looks for a GPS position. But If I configure Android as GPS, WLAN and Network, but Traccar only network, I never get a position. It all looks like traccar gets no position from the network location api, but like I said, other apps get the position.

Anton Tananaev7 years ago
Martin7 years ago

I read it, but I see no relevance to my case. It is not about battery drain but getting updates. Traccar sends nothing, when I am in a building and the phone finds no GPS position. Even when I configure traccar to rely only on network and not GPS it will not use the network position. That behaviour is not applicable to traccar in general, but in combination with two of my android devices. Since other apps get network position upddates on these devices (for example rtt2 is working in network mode on these devices, and sending positions without GPS), I was wondering, if you could look into changing the api/method of your network position retrieval.

Anton Tananaev7 years ago

There are 3 possible reasons I can think of:

  1. Network location provider is disabled on the phone
  2. App doesn't have proper permissions
  3. Some network issue

There is only one API on Android for retrieving network location. There are no other option.

Martin7 years ago

What can I say: I tried the app backitude to send the position updates to my traccar server, and it is working: My phone is with me at work like always, where the traccar app never sent a position update, and backitude is working like a charm. I did not restart my phone or change any android settings. I just installed the app, configured the server url and parameters.
Since this works for me, this is just a sincere hint, that there has to be something in the position retrieval code, that you could optimize.

Anton Tananaev7 years ago

There must be some explanation, but the problem is not with APIs that Traccar Client uses.