LocationManager no longer emitting values

Comments

3 comments

  • Avatar
    timklge

    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.

    https://hammerheadnav.github.io/karoo-ext/karoo-ext/io.hammerhead.karooext.models/-on-location-changed/index.html

    2
    Comment actions Permalink
  • Avatar
    Jason

    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.

    0
    Comment actions Permalink
  • Avatar
    Jason

    @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.

    1
    Comment actions Permalink

Please sign in to leave a comment.