Live Operation Service
Live Operation is a service to send push notifications to targeted app users through filtering. App admins can enhance the convenience of the advanced push system by integrating with Live Operation.
[Live Operation Service Overview]
Notice
- IGAW General Integration must be set in order to integrate Live Operation add-on. [IGAW General Integration: iOS]
- Inorder to integrate Live Operation, LiveOps~*.framework file must be included in Xcode project. [SDK Installation: iOS]
General Setting
These settings are required to use Live Operation service.
Upload APNS Certificate
APNS certificate created at Apple Developer Center has to be uploaded to the Live Operation Management page.
+ For develop version, upload .p12 type Development version, and add .p12 type Production certificate for App Store version.
Edit Info.plist
If iOS SDK Target is 7.0 and above, add the node below on Info.plist.
Live Operation API
Import LiveOps.h, IgaworksCore.h files to integrate.
Live Operation supports Server Push and Client Push.
Basic Integration / Server Push
Server Push is available with the basic integration. For the integration, add the code below at appliation: didFinishLaunchingWithOptions: and application: didRegisterForRemoteNotificationWithiDeviceToken: in AppDelegate.
Input User ID
User ID is to verify each user on Live Operation.
Notice
- One user should only have one unique value, not variable.
- Must not contain any personal information(email, name, phone number, username).
- Must go through URL encoding if contains Korean, special character, or black space.
- nvarchar(100) is the maximum length.
Follow the above notice when input the User ID value.
[IgaworksCore setUserId:@"user10001"];
Call Initialize API
- + (void)setUserId:(NSString *)userId
- + (void)initPush
- + (void)handleAllNotificationFromLaunch:(NSDictionary*)launchOptions
- + (void)setDeviceToken:(NSData*)deviceToken
#import <IgaworksCore/IgaworksCore.h>
#import <LiveOps/LiveOps.h>
@implementation AppDelegate
-(BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
//IGAWorks General Integration API
[IgaworksCore igaworksCoreWithAppKey:@"set app key" andHashKey:@"Set hash key" andIsUseIgaworksRewardServer:NO];
//In order to use LiveOpsPush, you must set the user id.
[IgaworksCore setUserId:@"user10001"];
//Initialize LiveOpsPush.
[LiveOpsPush initPush];
//Register LiveOps Push Notification Handler.
[LiveOpsPush handleAllNotificationFromLaunch:launchOptions];
return YES;
}
- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
//Register device token.
[LiveOpsPush setDeviceToken:deviceToken];
}
- (void)application:(UIApplication*)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
{
//Check device token register failed log
NSLog(@"Device Token Register Failed: %@", error);
}
Add Handler
Add Handler to manage push message.
#if __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_7_0
#warning "Remote push open tracking is counted only when user touches notification center under iOS SDK 7.0"
// iOS versions below 7,
- (void)application:(UIApplication*)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
[LiveOpsPush handleRemoteNotification:userInfo fetchHandler:nil];
}
#else
// iOS version7 and above,
- (void)application:(UIApplication*)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
{
[LiveOpsPush handleRemoteNotification:userInfo fetchHandler:completionHandler];
}
#endif
//Local Push Handler
- (void)application:(UIApplication*)application didReceiveLocalNotification:(UILocalNotification *)notification
{
[LiveOpsPush handleLocalNotification:notification];
}
+ Handler's standard is iOS 7 just like the code above and it needs to be added separately for each iOS version.
Deep link Integration / Server Push
Live Operation's Server Push offers deep link feature.
Deep Link enables users to perform an action defined in the Deep Link data when receiving and reading a push message.
A set of Deep Link data is created and managed in the Live Operation Admin page. Register data as Web URL(http://~) type, App Scheme URL(myApp://deepLinkAction) type, or Json({“url”:”deepLinkAction”}) type.
Edit Info.plist
Add a node in Info.plist to use deep link feature.
Deep Link Data Verification
To verify the received deep link data, you can use either Live Operation Listener or AppDelegate.
If you use Json type deep link, Live Operation Listener is the only option.
- Live Operation Listener
- AppDelegate
Use Live Operation Listener
To use the listener, you have to add the listener before handleAllNotificationFromLaunch: API.
You can see deep link information at pushInfos and specified information is:
- pushInfos.sentTime : Sent time
- pushInfos.bodyText : Push Message
- pushInfos.deepLinkUrl : Apple Scheme Url type deep link, default -> nil
- pushInfos.deepLink : Json type deep link, default -> nil
-(BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
// Register the Listener for Deep link
[LiveOpsPush setRemoteNotificationListener:^(NSArray* pushInfos, BOOL isForeGround) {
for(LiveOpsPushInfo *pushInfo in pushInfos){
/* pushInfos The opject */
// pushInfo.sentTime : Sent time
// pushInfo.bodyText : Push message
// pushInfo.deepLinkUrl : Deep link URL, default-nil
// pushInfo.deepLink : Deep link JsonObject, default-nil
/* isForeGround */
// YES : Receive push when the app is enabled
// NO : Receive push when app is not enabled
}
}];
//Register LiveOps Push Notification Handler.
[LiveOpsPush handleAllNotificationFromLaunch:launchOptions];
return YES;
}
Use AppDelegate
If you use Apple Scheme Url type deep link, you can read deep-link information using AppDelegate.
Do this by receiving information from url parameter at application: openUrl: sourceApplication: annotation: delegate.
#import "AppDelegate.h"
#import <IgaworksCore/IgaworksCore.h>
#import <LiveOps/LiveOps.h>
@implementation AppDelegate
-(BOOL)application:(UIApplication*)application openURL:(NSURL*)url sourceApplication:(NSString*)sourceApplication annotation:(idD)annotation
{
//This is where the push deep link will be transferred to.
//Use the checked deep link data to process the wanted action.
NSLog(@"LiveOps Deep Link Url Info : %@", [url absoluteString]);
//ex. When the deep link was received to liveOps://com.igaworks.test?view=myview¶m=1
NSString* query = [url query];
NSArray *queryPairs = [query componentsSeparatedByString:@"&"];
NSMutableDictionary *pairs = [NSMutableDictionary dictionary];
for(NSString* queryPair in queryPairs)
{
NSArray *bits = [queryPairs componentsSeparatedByString:@"="];
NSString *key = [bits objectAtIndex:0];
NSString *value = [bits objectAtIndex:1];
[pairs setObject:value forKey:key];
NSLog(@"LiveOps Deep Link Action~!! key: %@ , value: %@" , key, value);
}
return YES;
}
+ Json type deep link is unavailable for AppDelegate.
Local Push (Client Push)
Live Operation uses API within the client in order to offer client push feature.
When the required settings are satisfied, push message is created and exposed.
Furthermore, if it can communicate with a developer's server, it can catch server event to create push message.
Create and Expose
[LiveOpsPush registerLocalPushNotification:localPid //Unique identifier
date:dateObj //Date
body:@"hello" //Message that will be displayed in the local push
button:@"go": //Local push confirm button or unlock botton text
soundName:nil //Name of the sound file to execute, nil : play iOS default sound
badgeNumber:0 //The number on the unread messages that will be displayed on the app icon when unread
customPayload:nil //User information registered through customPayload
];
Cancel
Use cancelLocalPush: API to cancel any local push.
[LiveOpsPush cancelLocalPush:localPid]; //localPid : The push id entered when registering the local push
Listener
To use the listener, you have to add it before handleAllNotificationFromLaunch: API.
Here is more detailed information:
-(BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
[LiveOpsPush setLocalNotificationListener:^(NSInteger Id, NSDate* sentTime, NSString* bodyText, NSDictionary* customData, BOOL isForeGround) {
// Id : localPid : The push id entered when registered the local push
// sentTime : Sent time
// bodyText : Push message
// customData : Data registered through customPayload
/* isForeGround */
// YES : Receive push when the app is enabled
// NO : Receive push when the app is not enabled
}];
//Register LiveOps Push Notification Handler.
[LiveOpsPush handleAllNotificationFromLaunch:launchOptions];
return YES;
}
Live Operation : Additional Options
User Targeting
You can create a user group manually to move it to push targets.
You can manually set the data for creating user groups.
Set Targeting Data
//[LiveOpsUser setTargetingData:(NSString*)customUserData withKey:(NSString*)customUserDataKey]
[LiveOpsPush setTargetingData:@16 withKey:@"age"];
Import targeting data
NSNumber* ageNum = [LiveOpsUser getTargetingDataWithKey:@"age"];
Sync targeting data
[LiveOpsUser flush];
Enable/Disable Push
Set Push
- true : Receive Push.
- false : Does not receive Push.
[LiveOpsPush setRemotePushEnable:YES];
Use Delegate
We offer delegate for enable/disable push event.
setRemotePushEnable API is called, and this is the example including the parameter:
[LiveOpsPush setRemotePushEnable:NO completion:^(BOOL result) {
//If the result value is not true, it is not properly reflected in the server
//(Network problem or device token not registered)
if (result) {
//Use the transferred data to perform the wanted action.
}
}];