MRQSDK Class Reference
Inherits from | NSObject |
---|---|
Conforms to | CLLocationManagerDelegate |
Declared in | MRQSDK.h |
Overview
The MRQSDK makes it easy for your application to interact with MobileRQ. It performs the following services:
- Collect data you share and sends it to the MobileRQ service.
- Process responses from the MobileRQ service.
- Process push messages sent by the MobileRQ service.
- Display rich content within the app using custom views MRQContentView, MRQContentTableViewController, and MRQSlotViewController.
Get the latest SDK and docs at http://www.mobilerq.com/documentation/ios-sdk/. Need help? Contact us at support@mobilerq.com.
Getting the MRQSDK Instance
Getting and Setting the MRQSDK Delegate
Configuring MRQSDK
clientID
The client ID assigned to your app by the MobileRQ service.
@property (nonatomic) NSString *clientID
Declared In
MRQSDK.h
customerID
Unique identifier for the end user of the app. Make sure you securely encode personally identifiable information before setting this.
@property (nonatomic) NSString *customerID
Declared In
MRQSDK.h
apiHost
The API host name and scheme. It defaults to the MobileRQ service. Only change this when debugging.
@property NSString *apiHost
Declared In
MRQSDK.h
Hooking Application Events
– application:didFinishLaunchingWithOptions:
Set up MRQSDK after application launch.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
Parameters
application |
The singleton UIApplication object |
---|---|
launchOptions |
The NSDictionary object received by UIApplication application:didFinishLauchingWithOptions: |
Return Value
YES if the app was launched by a remote notification and it was recognized by MRQSDK, otherwise returns NO.
Discussion
This should be called from UIApplication application:didFinishLaunchingWithOptions:. If the app was launched with a remote notification, this will receive MobileRQ push messages and set lastNotification. You need to call refresh to download push message content.
See Also
Declared In
MRQSDK.h
– application:didReceiveRemoteNotification:
Handle a remote push notification. Call from application:didReceiveRemoteNotification:.
- (BOOL)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
Parameters
application |
The singleton UIApplication object |
---|---|
userInfo |
The NSDictionary object received by the application’s UIApplication application:didReceiveRemoteNotification: method |
Return Value
YES if the message was recognized by MRQSDK, otherwise returns NO.
Declared In
MRQSDK.h
Location Tracking
– updateLocation:
Call this method each time the application receives a location update.
- (void)updateLocation:(CLLocation *)currentLocation
Parameters
currentLocation |
A CLLocation object either from CLLocationManager or manually created. |
---|
Declared In
MRQSDK.h
– startMonitoringLocation
Begin monitoring location.
- (void)startMonitoringLocation
Discussion
This monitors location while the app is in the background. Calling this will prompt the user for permission using CLLocationManager requestAlwaysAuthorization. The prompt requires you add NSLocationAlwaysUsageDescription in your apps Info.plist file. Once you call startMonitoringLocation you no longer need to call updateLocation:.
Warning: From Apple’s developer docs: Requesting “Always” authorization is discouraged because of the potential negative impacts to user privacy. You should request this level of authorization only when doing so offers a genuine benefit to the user.
Declared In
MRQSDK.h
– startMonitoringLocationIfAuthorized
Begin monitoring location only if the app is authorized.
- (BOOL)startMonitoringLocationIfAuthorized
Return Value
YES if authorizationStatus is always, otherwise NO
Discussion
Like startMonitoringLocation, this monitors location while the app is in the background. Background monitoring requires “Always” authorization. If CLLocationManager authorizationStatus is not kCLAuthorizationStatusAuthorizedAlways this method will do nothing.
Declared In
MRQSDK.h
– stopMonitoringLocation
Stop monitoring location.
- (void)stopMonitoringLocation
Declared In
MRQSDK.h
lastLocation
The last location seen by MRQSDK. This is updated when you use updateLocation: or startMonitoringLocation.
@property (readonly) CLLocation *lastLocation
Declared In
MRQSDK.h
Push Messaging
– registerDeviceToken:
Register an APN deviceToken with MobileRQ. Call from UIApplication application:didRegisterForRemoteNotificationsWithDeviceToken:.
- (void)registerDeviceToken:(NSData *)deviceToken
Parameters
deviceToken |
the APN device token |
---|
Declared In
MRQSDK.h
– registerSlotName:
Register a slot with MobileRQ. Content can be assigned to registered slots. Register the name when adding a slot view to your app. Calling refresh sends the list of registered slot names to MobileRQ.
- (void)registerSlotName:(NSString *)slotName
Parameters
slotName |
The slot name to register with MRQ |
---|
Declared In
MRQSDK.h
lastNotification
The last remote notification received from the MRQ service. This is set by application:didFinishLaunchingWithOptions: or application:didReceiveRemoteNotification: and cleared by refresh.
@property (readonly) NSDictionary *lastNotification
Declared In
MRQSDK.h
Content
matchingContentURL
The URL for matching content from the last refresh, or nil if there is no matching content.
@property (readonly) NSURL *matchingContentURL
Declared In
MRQSDK.h
matchingContent
The matching content from the last refresh.
@property (readonly) NSArray *matchingContent
Declared In
MRQSDK.h
viewedContent
The content viewed since the last refresh.
@property (readonly) NSArray *viewedContent
Declared In
MRQSDK.h
clickedContent
The content clicked since the last refresh.
@property (readonly) NSArray *clickedContent
Declared In
MRQSDK.h
– trackAllContentViewed
Call this method to indicate that all MRQContent was viewed. Views are tracked by the MobileRQ service.
- (void)trackAllContentViewed
Declared In
MRQSDK.h
– trackContentViewed:
Call this method to indicate that MRQContent was viewed. Views are tracked by the MobileRQ service.
- (void)trackContentViewed:(MRQContent *)mrqContent
Parameters
mrqContent |
The MRQContent that was viewed |
---|
Declared In
MRQSDK.h
– trackContentClicked:
Call this method to indicate that MRQContent was clicked or tapped. Clicks are tracked by the MobileRQ service.
- (void)trackContentClicked:(MRQContent *)mrqContent
Parameters
mrqContent |
The MRQContent that was clicked |
---|
Declared In
MRQSDK.h