...
Code Block |
---|
language | applescript |
---|
title | Objective-C |
---|
|
- (void) application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
NSLog(@"didRegisterForRemoteNotificationsWithDeviceToken");
[[EuroManager sharedManager:@"AppcentIOSTest1"] registerToken:deviceToken];
} |
Code Block |
---|
language | applescript |
---|
title | Swift |
---|
|
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
EuroManager.sharedManager("AppcentIOSTest1").registerToken(deviceToken)
} |
In the
Status |
---|
subtle | true |
---|
colour | Red |
---|
title | application:didRegisterForRemoteNotificationsWithDeviceToken: |
---|
|
method, deviceToken variable is the generated token by APNS. After receiving this token, registerToken method is called in EuroManager. This token value must be recorded to the RMC system in order to send messages. In the example,
Status |
---|
| |
---|
subtle | true |
---|
colour | Red |
---|
title | AppcentIOSTest1 |
---|
|
value is a code value that is given by RMC for your application.
EuroManager instance is activated as shown below:
Code Block |
---|
language | applescript |
---|
title | Objective-C |
---|
|
[[EuroManager sharedManager:@"AppcentIOSTest1" setUserKey: @"egemen@visilabs.com"];
[[EuroManager sharedManager:@"AppcentIOSTest1"] setUserEmail: @"egemen@visilabs.com"];
[[EuroManager sharedManager:@"AppcentIOSTest1"] synchronize];
|
Code Block |
---|
language | applescript |
---|
title | Swift |
---|
|
let euroInstance: EuroManager = EuroManager.sharedManager("AppcentIOSTest1")
euroInstance.setUserEmail("egemen@visilabs.com")
euroInstance.setUserEmail("egemen@visilabs.com")
euroInstance("AppcentIOSTest1").synchronize()
|
If the additional parameters of the user are known, they can be added as shown below:
Code Block |
---|
language | applescript |
---|
title | Objective-C |
---|
|
[[EuroManager sharedManager:@"AppcentIOSTest1"] userEmail: @"egemen@visilabs.com"];
[[EuroManager sharedManager:@"AppcentIOSTest1"] setUserKey: @"egemen@visilabs.com"];
[[EuroManager sharedManager:@"AppcentIOSTest1"] synchronize];
|
Code Block |
---|
language | applescript |
---|
title | Swift |
---|
|
let euroInstance: EuroManager = EuroManager.sharedManager("AppcentIOSTest1")
euroInstance.setUserEmail("egemen@visilabs.com")
euroInstance.setUserKey("egemen@visilabs.com")
euroInstance.synchronize() |
In any step, if you add a new parameter and want to send it to the RMC server, you should call the "synchronize" method:
Use the following method when the user logs in to your mobile app:
Code Block |
---|
language | applescript |
---|
title | Objective-C |
---|
|
[[EuroManager sharedManager:@"AppcentIOSTest1"] synchronize]; |
Code Block |
---|
language | applescript |
---|
title | Swift |
---|
|
EuroManager.sharedManager("AppcentIOSTest1").synchronize()
|
If a push notification arrives, application:didReceiveRemoteNotification method is invoked. The incoming message content should be given to the handlePush method in the EuroManager instance.
Code Block |
---|
language | applescript |
---|
linenumberstitle | trueObjective-C |
---|
|
- (void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
NSLog(@"didReceiveRemoteNotification : %@",userInfo); [[EuroManager sharedManager:@"AppcentIOSTest1"] handlePush:userInfo];
} |
Code Block |
---|
language | applescript |
---|
title | Swift |
---|
|
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]){
EuroManager.sharedManager("AppcentIOSTest1").handlePush(userInfo)
} |
If you are using iOS 8 or later version, the following method should be called:
Code Block |
---|
language | applescript |
---|
linenumbers | true |
---|
|
- (void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { NSLog(@"didReceiveRemoteNotification:fetchCompletionHandler : %@",userInfo); [[EuroManager sharedManager:@"AppcentIOSTest1"] handlePush:userInfo completionHandler:completionHandler]; } |
When an interactive push is sent, the information of which button is clicked by the user should be transmitted to RMC. For this application: Status |
---|
subtle | true |
---|
colour | Red |
---|
title | handleActionWithIdentifier:forRemoteNotification:completionHandler: |
---|
|
method in the Status |
---|
subtle | true |
---|
colour | Red |
---|
title | AppDelegate |
---|
|
is called as shown below:
Code Block |
---|
language | applescript |
---|
linenumbers | true |
---|
|
- (void) application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void (^)())completionHandler { NSLog(@"push clicked : %@ %@",userInfo,identifier); [[EuroManager sharedManager:@"AppcentIOSTest1"] handleInteractiveAction:identifier userInfo:userInfo]; if(completionHandler != nil) { completionHandler(UIBackgroundFetchResultNewData); } } |
Variables in the Message class:
Variable | Description |
---|
messageContent | Message |
URL | An optional URL |
params | Custom parameters |
pushType | Push Type |
altURL | Alternate URL |
mediaUrl | Image and Video content URL |
cId | Campaign id |
sound | Sound name |
...