LocationManager no longer emitting values
Is there any reason why android.location.LocationManager.requestLocationUpdates() would stop emitting location data? It emits data just fine on K2, but K3 is not emitting anything. This post on github makes me think this functionality hasn't been removed from Karoo's port of AOSP:
https://github.com/hammerheadnav/karoo-ext/issues/9#issuecomment-2511468538
I am running latest builds on both K2 (1.554.2125.12) and K3 (1.554.2125.20). The ride app is correctly showing users location so the underlying GPS data must be fine.
-
A while ago, Hammerhead added the ability to stream location updates via the extension service. You don't have to deal with permissions etc, any extension has access. It is also consistent with the position and rotation visible to the user on the karoo map, so I think unless you absolutely need to directly use the Android APIs, this is the preferred and "idiomatic" way to get location updates.
Estimated GPS accuracy in meters could be streamed via the respective data types if required.
-
I figured out the issue. I was asking LocationManger for the best provider val provider = getBestProvider(criteria, true). On both K2 this returns "gps" and K3 this returns "fused". The later doesn't seem to emit *any* location data. If I force K3 to use "gps" provider then I get location data just fine.
-
@timklge If I was building something from scratch today I would definitely use that. It looks really convenient. However I already have LocationManager + permissions + foreground service setup to support Android devices that are not Karoo devices, and also to support older devices still using the older SDK.
Please sign in to leave a comment.
Comments
3 comments