Skip to content

User Location

The user's current location can be passed into the SDK using the userLocation property. This location will be used to provide more relevant offers to the user. Updating the location does not automatically reload the feed, but will be used in any subsequent network queries. Because of this, it is recommended to pass in the user's location before presenting the SDK.

1
Dosh.instance?.userLocation = CLLocation(latitude: 30.275039, longitude: -97.740320)
1
2
3
4
5
val location = android.location.Location(LocationManager.GPS_PROVIDER).apply {
    latitude = 30.275039
    longitude = -97.740320
}
PoweredByDosh.instance?.userLocation = location

Offer Behavior when Location is not Provided

Note that the userLocation field is an optional parameter. If location is not directly provided, the experience will degrade to leveraging location context associated with the IP Address of the incoming request. This context will be used to approximate the user's location and return local offers relative to that approximation. Local offers require location context to be displayed and leveraging IP based geo ensures that content is always available to the end user.