Oracle Help Center | Oracle Responsys Mobile App Platform Cloud Service title

Location-based Push

Prerequisites

  1. Insert the PushIOManager framework and your pushio_config_debug.json (Development) or pushio_config.json (Distribution) in your project.
  2. Ensure that the CoreLocation framework has been added to your project as well.
  3. Add the -ObjC and -all_load linker flags to the Other Linker Flags section in Xcode - this is necessary or your application won't target the CoreLocation frameworks properly:

"Adding other linker flags to project in Xcode"

Once these steps have been taken, add the necessary code in your project to enable PushIOManager to begin tracking location.

NOTE: PushIOManager's location tracking uses Apple's Significant Change functionality by default.

Integrating Location Code

[1] Import the location manager in your AppDelegate.h file:

#import <PushIOManager/PushIOManager+PushIOLocation.h>
        
import PushIOManager
        

NOTE: The #import <PushIOManager/PushIOManager.h> statement can be deleted, as the location header file also contains code from the basic PushIOManager (hence PushIOManager+PushIOLocation.h).

[2] On the @interface line in AppDelegate.h, target the PushIOManagerLocationDelegate. This can replace the basic PushIOManagerDelegate, as this delegate will handle those tasks as well:

"Xcode screen, integrating the location code"

[3] In the AppDelegate.m file, tell the application to begin tracking location on start-up (didFinishLaunchingWithOptions):

[[PushIOManager sharedInstance] startUpdatingLocationForPush];
        
PushIOManager.sharedInstance().startUpdatingLocationForPush()
        

Tip: The top portion of your AppDelegate.m file should look something like this:

Screenshot of AppDelegate.m file with Objective-c location code
Screenshot of AppDelegate.m file with Swift location code

[4] Mandatory: Add one of two lines to your Info.plist for necessary Location support, depending on the use-case of your application:

NSLocationWhenInUseUsageDescription - "Location Description When In Use"
NSLocationAlwaysUsageDescription - "Location Description Always In Use"

For example,

"NSLocationWhenInUseUsageDescription setting screen shot"

This concludes basic setup for location-based push notifications. On first start-up, your device should ask if you would like to enable location services for your application.


Sending Location Pushes

Responsys takes the longitude and latitude info sent by the mobile app and, using the GeoNames database, converts them into human-readable location attributes. These attributes are stored in the App Channel List in the fields DEVICE_COUNTRY_CODE_, DEVICE_CITY_, DEVICE_POSTAL_CODE_, ADMIN_AREA1_, and ADMIN_AREA2_. A marketer using Responsys creates filters using the location attributes in the App Channel List, and then uses those filters to define the audience for their campaign.

For more information about the App Channel List, see the Mobile App Channel Configuration Guide.