Product

Open-source Radar SDK v3 with custom tracking options, now in public beta

by

Nick Patrick

on

February 11, 2020

At Radar, we've spent years working to build the most developer-friendly location SDK.

Today, we're releasing a public beta of SDK v3. We're introducing new tracking options that make the SDK more flexible than ever. We're also exposing new APIs for geocoding, search, and distance, now in private beta. And we're open-sourcing our iOS and Android SDKs for the first time.

v3

v3 expands on the tracking options in v2 and introduces new tracking options, with the following presets:

  • EFFICIENT, with a low frequency of location updates and lowest battery usage. On Android, avoids Android vitals bad behavior thresholds.
  • RESPONSIVE, with a medium frequency of location updates and low battery usage. Suitable for most consumer use cases.
  • CONTINUOUS, with a high frequency of location updates and higher battery usage. Suitable for on-demand use cases (e.g., delivery tracking) and some consumer use cases (e.g., order ahead, "mall mode").

You can also customize these presets or provide a fully custom bundle of tracking options. Intervals, accuracy, stop detection, start and stop times, and offline replay are all configurable:

// presets
Radar.startTracking(RadarTrackingOptions.efficient)
Radar.startTracking(RadarTrackingOptions.responsive)
Radar.startTracking(RadarTrackingOptions.continuous)

// custom
let trackingOptions = RadarTrackingOptions.continuous
trackingOptions.desiredMovingUpdateInterval = 60
trackingOptions.desiredStoppedUpdateInterval = 180
trackingOptions.desiredAccuracy = .high
trackingOptions.stopDuration = 50
trackingOptions.stopDistance = 30
trackingOptions.stopTrackingAfter = date
trackingOptions.sync = .all
Radar.startTracking(trackingOptions)

v3 also introduces a new Radar.getContext() function. Unlike Radar.trackOnce(), this function does not send identifiers to the server or persist user state, great for on-device context and privacy-first use cases:

// stateful
Radar.trackOnce { (status, location, events, user) in
  // do something with user?.geofences, user?.place
}

// stateless
Radar.getContext { (status, location, context) in
  // do something with context?.geofences, context?.place
}

Finally, v3 exposes new search, geocoding, and distance APIs, currently in private beta:

Radar.searchGeofences(
  tags: ["venue"],
  limit: 100
) { (status, geofences) in
  // do something with geofences
}

Radar.searchPlaces(
  chains: ["mcdonalds"],
  radius: 10000
) { (status, places) in
  // do something with places
}

Radar.autocomplete(
  query: "brooklyn roasting",
  near: CLLocation(latitude: 40.70390, longitude: -73.98670),
  limit: 10
) { (status, addresses) in
  // do something with addresses
}

Radar.geocode(
  address: "20 jay st brooklyn"
) { (status, location) in
  // do something with location
}

Radar.reverseGeocode(
  location: CLLocation(latitude: 40.70390, longitude: -73.98670)
) { (status, addresses) in
  // do something with addresses
}

Radar.ipGeocode { (status, country) in
  // do something with country?.code
}

Radar.getDistance(
  destination: CLLocation(latitude: 40.70390, longitude: -73.98670),
  modes: [.foot, .car],
  units: .imperial
) { (status, routes) in 
  // do something with routes?.car?.duration.value
}

Learn more about these new APIs here.


Already using Radar? There are minimal breaking changes from SDK v2, so upgrading is fast and easy. Check out the SDK v3 documentation, iOS migration guide and the Android migration guide.

New to Radar? Sign up, then check out the SDK documentation and migration guides to get started.

Want to stay in the loop about new launches? Subscribe to the newsletter below.

Happy coding!

It's time to build

See what Radar’s location and geofencingsolutions can do for your business.