Why there is no continuous location update there is a gap of 1 hour that is was travelling not recorded, what scenario cause location updated pause?

Shifa8 months ago

I have traccar client code implemented and have set the interval 3 mins to update location , I can see there is a gap of 1 hour and the location is straight line from start to end , there is no middle joining points. I'm am not able to get the use case that caused this.
My Traccar Server Route logs:
As u can see in the last 2 update it has a very big gap in location update ,As per my knowlede all permissions wer same , internet was on , and i left home and reached office , that entire route is straight line as there is no other location updated.

Fraz Test Agent SM-M236B samsung	2023-09-06 07:54:57	25.259599°	55.324094°	0.00 kn	
Fraz Test Agent SM-M236B samsung	2023-09-06 07:57:57	25.259599°	55.324094°	0.00 kn	
Fraz Test Agent SM-M236B samsung	2023-09-06 08:54:39	25.185949°	55.274903°	0.00 kn	
Fraz Test Agent SM-M236B samsung	2023-09-06 09:54:53	25.185945°	55.274910°	0.00 kn	
Anton Tananaev8 months ago

Probably the app was killed by the OS.

Shifa8 months ago

No , there are logs before and after the travelling , even today same scenario noticed , As you can see there is a gap of around 1 hour in marked location , is this related w.r.t provider?? Can you please explain me how the provider gets updated

Fraz Test Agent SM-M236B samsung	2023-09-07 07:48:31	25.258218°	55.322365°	0.00 kn	
Fraz Test Agent SM-M236B samsung	2023-09-07 07:53:32	25.258218°	55.322365°	0.00 kn	
Fraz Test Agent SM-M236B samsung	2023-09-07 07:58:31	25.259728°	55.324258°	0.00 kn	>>>>>>>>>>>
Fraz Test Agent SM-M236B samsung	2023-09-07 08:53:43	25.185964°	55.274792°	0.00 kn	>>>>>>>>>>>
Fraz Test Agent SM-M236B samsung	2023-09-07 09:47:22	25.185965°	55.274791°	0.00 kn	
Fraz Test Agent SM-M236B samsung	2023-09-07 09:52:39	25.185964°	55.274791°	0.00 kn
Shifa8 months ago

Another doubt , in the traccar server it shows device active 30mins ago, 40 mins ago etc.. so for same 30mins there is no location updated in route.what scenario makes it inactive , why does the traccar client not update location , though it is connected to internet everything , if it is in same location for long , it stops updating ? or what is the scenario that leads to this inactive

Anton Tananaev8 months ago

There's no logic in the app to stop updating location.

Shifa8 months ago

It is working as expected in other versions , but only in android 13 i am facing this issue. is there any restriction or anything that i might need to update

Anton Tananaev8 months ago

I'm not aware of any, but there could be.

Shifa8 months ago

Hi,
I have changed the getprovider code , now it is taking provider as fused , and it is working fine

  private fun getProvider(context: Context): String {
        val locationManager = context.getSystemService(Context.LOCATION_SERVICE) as LocationManager
        val criteria = Criteria()

        // Set criteria for high accuracy
        criteria.accuracy = Criteria.ACCURACY_FINE

        // Try to get the GPS provider
        val gpsProvider = locationManager.getBestProvider(criteria, true)

        if (gpsProvider != null) {
            return gpsProvider  // Use GPS provider if available
        } else {
            // GPS provider is not available, try network provider
            criteria.accuracy = Criteria.ACCURACY_COARSE
            val networkProvider = locationManager.getBestProvider(criteria, true)

            if (networkProvider != null) {
                return networkProvider  // Use network provider if available
            } else {
                // Network provider is not available, check for other location providers
                if (isFusedLocationProviderAvailable(context)) {
                    return LocationManager.FUSED_PROVIDER  // Use Fused Location Provider if available
                } else {
                    // If none of the providers are available, fall back to passive
                    return LocationManager.PASSIVE_PROVIDER
                }
            }
        }
    }