Background Location Updates
Normally, the app downloads new regions and messages as the device moves more than 5 kilometers from the last location and download of this data. However, if your app serves customers who spend a lot of time within a single 5K radius, consider adding the ability to do a background refresh of regions and messages. Since Apple controls when this background refresh takes place, we cannot guarantee when the refresh occurs. However, Apple allows the SDK to download new regions and messages for those times your customer spends a considerable amount of time in a single 5K region.
In your Info.plist, implement this key to enable this function. We require “App downloads content from the network” to perform a Background App Refresh periodically to refresh geofences and beacons.
In your Info.plist, add keys under UIBackgroundModes
:
<array>
<string>fetch</string>
<string>location</string>
<string>remote-notification</string>
</array>
fetch
: We require “App downloads content from the network” to perform a background app refresh periodically to refresh geofences and beacons.
location
: We require “App registers for location updates” to enable location in the MarketingCloudSDK and to range for beacons in the background.
In your application delegate method -application:didFinishLaunchingWithOptions:
, implement this code:
Implement the handler for this functionality in your application delegate class:
See MarketingCloudSDK+Base.h for more information about this method.