- The
Radar.trackVerified()
method now returnstoken: RadarVerifiedLocationToken
, which includesuser
,events
,token,
,expiresAt
,expiresIn
, andpassed
. TheRadar.trackVerifiedToken()
method has been removed, sinceRadar.trackVerified()
now returns a signed JWT.
// 3.13.x
Radar.trackVerified { (status, token) in
if (token?.passed == true) {
// allow access to feature, send token to server for validation
} else {
// deny access to feature, show error message
}
}
// 3.12.x
Radar.trackVerified { status, location, events, user ->
if (user?.fraud?.passed == true &&
user.country?.allowed == true &&
user.state?.allowed == true) {
// allow access to feature
} else {
// deny access to feature, show error message
}
}
Radar.trackVerifiedToken { status, token ->
// send token to server for validation
}
- The
RadarReceiver
interface has been changed to add aonLocationPermissionStatusUpdated()
method.
- The
Radar.searchGeofences()
methods have been changed. UseincludeGeometry
to include full geometry of the geofence. Radius is now optional.
- The
Radar.autocomplete(query, near, layers, limit, country, expandUnits, callback)
method is nowRadar.autocomplete(query, near, layers, limit, country, expandUnits, mailable, callback)
.expandUnits
has been deprecated and will always be true regardless of value passed in.
- Custom events have been renamed to conversions.
Radar.sendEvent(customType, metadata, callback)
is nowRadar.logConversion(name, metadata, callback)
.Radar.logConversion(name, revenue, metadata, callback)
has been added.Radar.sendEvent(customType, metadata, location, callback)
has been removed.RadarSendEventCallback
has been renamed toRadarLogConversionCallback
.onComplete(status, location, events, user)
is nowonComplete(status, event)
.location
anduser
are no longer available, and only the conversion event is returned asevent
instead of a coalesced list of events.
- On
RadarEvent
,customType
is nowconversionName
, andRadarEventType.CUSTOM
is nowRadarEventType.CONVERSION
.
// 3.7.0 - logging conversions
val metadata = JSONObject().put("foo", "bar")
val callback = object : Radar.RadarLogConversionCallback {
override fun onComplete(status: Radar.RadarStatus, event: RadarEvent?) {
val conversionName = event?.conversionName // should be "conversion_with_callback"
val conversionType = event?.type // should be RadarEvent.RadarEventType.CONVERSION
}
}
Radar.logConversion("conversion_with_callback", metadata, callback)
Radar.logConversion("conversion_with_revenue", 0.2, metadata) { status, event ->
val revenue = event?.metadata?.get("revenue") // should be 0.2
}
// 3.6.x - logging conversions
val metadata = JSONObject().put("foo", "bar")
val callback = object : Radar.RadarSendEventCallback {
override fun onComplete(status: Radar.RadarStatus, location: Location?, events: Array<RadarEvent>?, user: RadarUser?) {
}
}
Radar.sendEvent("custom_event_with_callback", metadata, callback)
// sendEvent() with location no longer exists in 3.7.0
Radar.sendEvent("event_with_location", Location(...), metadata) { status, location, events, user ->
}
- If your application depends on classes in
com.google.android.gms.location
, you may need to update your code to reflect the changes made toplay-services-location
in version 20.0.0, as documented here. Version 3.5.8 of the Radar SDK updatesplay-services-location
to version 21.0.1. Besides the Radar SDK, if your application does not depend on classes incom.google.android.gms.location
no migrations are necessary.
foregroundService
is no longer available inRadarTrackingOptions
. This has been replaced byRadar.setForegroundServiceOptions
instead.
// 3.4.x - enabling foreground service
// enable or disable the foreground service
val trackingOptions: RadarTrackingOptions = RadarTrackingOptions(...)
trackingOptions.foregroundServiceEnabled = true
// set the foreground service options
val foregroundOptions: RadarTrackingOptionsForegroundService = RadarTrackingOptionsForegroundService(...)
Radar.setForegroundServiceOptions(foregroundOptions)
// start tracking
Radar.startTracking(trackingOptions)
// 3.3.x - enabling foreground service
val trackingOptions: RadarTrackingOptions = RadarTrackingOptions(...)
trackingOptions.foregroundService = RadarTrackingOptionsForegroundService(...)
Radar.startTracking(trackingOptions)
No changes needed.
RadarReceiver
no longer subclassesBroadcastReceiver
. Instead of registeringRadarReceiver
in your manifest, pass an instance toRadar.initialize()
in applicationonCreate()
.RadarTripCallback
now returnstrip
andevents
on calls toRadar.startTrip()
,Radar.updateTrip()
,Radar.completeTrip()
, andRadar.cancelTrip()
.- On
RadarReceiver
,user
is now optional ononEventsReceived()
.user
will benull
when events are delivered from calls toRadar.startTrip()
,Radar.updateTrip()
,Radar.completeTrip()
, andRadar.cancelTrip()
. trackingOptions.foregroundService
now starts a foreground service by default when usingRadarTrackingOptions.CONTINUOUS
. If you are already starting a foreground service when usingRadarTrackingOptions.CONTINUOUS
, consider usingtrackingOptions.foregroundService
instead.
// 3.2.x
// instead of registering `RadarReceiver` in your manifest, pass `RadarReceiver` to `initialize()`
val receiver = MyRadarReceiver()
Radar.initialize(context, publishableKey, receiver)
// `RadarTripCallback` now returns `trip` and `events`
Radar.startTrip(tripOptions) { status, trip, events ->
}
// `user` is now optional
override fun onEventsReceived(context: Context, events: Array<RadarEvent>, user: RadarUser?) {
}
// 3.1.x
Radar.initialize(context, publishableKey)
Radar.startTrip(options: options) { status in
}
override fun onEventsReceived(context: Context, events: Array<RadarEvent>, user: RadarUser) {
}
- The
Radar.trackOnce(desiredAccuracy, callback)
method is nowRadar.trackOnce(desiredAccuracy, beacons, callback)
. Usebeacons = true
to range beacons. - The
Radar.stopTrip()
method has been removed. CallRadar.completeTrip()
orRadar.cancelTrip()
instead. - The
ACCESS_BACKGROUND_LOCATION
permission has been removed from the SDK manifest. If using background location, you must manually add the permission to your app manifest.
- This update introduces new tracking options and presets. See the announcement, the background tracking documentation, and the tracking options reference.
- If you were using
Radar.startTracking()
, you must choose a preset. v2 default behavior was similar toRadar.startTracking(RadarTrackingOptions.RESPONSIVE)
. - If you were using
RadarTrackingOptions.Builder().priority(RadarTrackingPriority.EFFICIENCY)
, use the presetRadarTrackingOptions.EFFICIENT
instead.
- If you were using
- Support Library dependencies have been migrated to AndroidX. The
WorkManager
dependency has been removed. - The
Radar.initialize(context, publishableKey)
method now requirescontext
andpublishableKey
. - The
Radar.updateLocation(location, callback)
method has been renamed toRadar.trackOnce(location, callback)
. - The
onClientLocationUpdated()
method is now required inRadarReceiver
. It tells the receiver that the client's location was updated, but not necessarily synced to the server. To receive only server-synced location updates and user state, useonLocationUpdated()
instead. adId
collection is now optional. To collectadId
, callRadar.setAdIdEnabled(true)
.Radar.setPlacesProvider(placesProvider)
has been removed.
// 3.0.x
Radar.initialize(context, publishableKey);
Radar.trackOnce(location, callback);
Radar.startTracking(RadarTrackingOptions.EFFICIENT);
Radar.setAdIdEnabled(true);
// 2.1.x
Radar.initialize(publishableKey);
Radar.updateLocation(location, callback);
RadarTrackingOptions trackingOptions = new RadarTrackingOptions.Builder()
.priority(RadarTrackingPriority.EFFICIENCY)
.build();
Radar.startTracking(trackingOptions);
- This update introduces
Radar.startTracking(trackingOptions)
to configure advanced tracking options. See https://radar.io/documentation/sdk-v2. - The
Radar.setTrackingPriority(priority)
method has been removed. UseRadarTrackingOptions.Builder().priority(priority)
and callRadar.startTracking(trackingOptions)
instead. See https://radar.io/documentation/sdk-v2.
// 2.1.x
RadarTrackingOptions trackingOptions = new RadarTrackingOptions.Builder()
.priority(RadarTrackingPriority.EFFICIENCY)
.build();
Radar.startTracking(trackingOptions);
// 2.0.x
Radar.setTrackingPriority(RadarPriority.EFFICIENCY);
Radar.startTracking(trackingOptions);
- The package has been renamed from
com.onradar.sdk.*
toio.radar.sdk.*
. - The
Radar.initialize(activity)
andRadar.initialize(activity, publishableKey)
methods have been removed. CallRadar.initialize(publishableKey)
instead. - The
RadarReceiver
action has been renamed fromcom.onradar.sdk.RECEIVED
toio.radar.sdk.RECEIVED
. Update theintent-filter
in your manifest. - The
RadarCallback
class has moved fromcom.onradar.sdk.RadarCallback
toio.radar.sdk.Radar.RadarCallback
, and theonCallback()
method has been renamed toonComplete()
. - The
Radar.requestPermissions()
andRadar.checkSelfPermissions()
helper methods have been removed. Call the corresponding methods onActivityCompat
andContextCompat
instead. https://developer.android.com/training/permissions/requesting - The
RadarStatus.ERROR_USER_ID
andRadarStatus.ERROR_PLACES
enum values have been removed. The SDK now handles these cases gracefully.
- On
RadarUser
,userId
is now nullable. - The
Radar.reidentifyUser()
method has been removed. To reidentify a user, callRadar.setUserId()
with the newuserId
instead.