Using App42 Push Notification – Backend as a Service
Posted on August 26, 2012 by Ajay Tiwari
String userName = "Nick" String deviceToken = "http://sn1.notify.live.net/xxxxxxx/01.00/xxxxxxxxxxx"; App42Callback requestCallback = this; /* This function used the App42Callback interface */ ServiceAPI api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); PushnotificationService pushnotificationService = api.BuildPushnotificationService(); pushnotificationService.StoreDeviceToken(userName, deviceToken, requestCallback); OnSucess(Object obj) { PushNotification push = (PushNotification) obj; String jsonResponse = push.ToString(); } public class CallBack : App42Callback { public override void OnSuccess(Object obj) { PushNotification push = (PushNotification) obj; //Do whatever you want with the object } public override void OnException(App42Exception e) { //Do whatever you want with the exception } }
String username = "Nick"; String deviceToken = "xxxxxxx-xxxxxxxxxxx"; ServiceAPI api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); PushnotificationService pushnotificationService = api.buildPushnotificationService(); PushNotification pushNotification = pushnotificationService.storeDeviceToken(username,deviceToken);
NSString *username = @"Nick"; NSString *deviceToken = @"0213c473a389687c6094a5b6d445c0fbf27dca069e2c7ff9be979exxxxxxxxxx"; ServiceAPI *serviceAPIObj = [[ServiceAPI alloc]init]; serviceAPIObj.apiKey = @"<API_KEY>"; serviceAPIObj.secretKey = @"<SECRET_KEY>"; PushnotificationService *pushnotificationService = [serviceAPIObj buildPushnotificationService]; PushNotification *pushNotification = [pushnotificationService storeDeviceToken:username:deviceToken];
String userName = "Nick"; String title = "Hello"; String subTitle = "Nick"; String param = "/Page.xml"; App42Callback requestCallback = this; /* This function used the App42Callback interface */ ServiceAPI api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); PushnotificationService pushnotificationService = api.BuildPushnotificationService(); pushnotificationService.SendPushToastMessageToUser(userName, title, subTitle, param, requestCallback); OnSucess(Object obj) { PushNotification push = (PushNotification) obj; String jsonResponse = push.ToString(); } public class CallBack : App42Callback { public override void OnSuccess(Object obj) { PushNotification push = (PushNotification) obj; //Do whatever you want with the object } public override void OnException(App42Exception e) { //Do whatever you want with the exception } }
String userName = "Nick"; String message = "Mary Kom won the bronze medal in Olympics"; ServiceAPI api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); PushnotificationService pushnotificationService = api.buildPushnotificationService(); PushNotification pushNotification = pushNotificationService.sendPushMessageToUser(userName,message);
NSString *userName = @"Nick"; NSString *message = @"Mary Kom won the bronze medal in Olympics"; ServiceAPI *serviceAPIObj = [[ServiceAPI alloc]init]; serviceAPIObj.apiKey = @"<API_KEY>"; serviceAPIObj.secretKey = @"<SECRET_KEY>"; PushnotificationService *pushnotificationService = [serviceAPIObj buildPushnotificationService]; PushNotification pushNotification = [pushNotificationService sendPushMessageToUser:userName Message:message];
String userName = "Nick"; String message = "Hi Nick! you have won 10 points"; ServiceAPI api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); PushnotificationService pushnotificationService = api.BuildPushnotificationService(); PushNotification pushNotification = pushnotificationService.sendPushMessageToUser(userName,message); String jsonResponse = pushNotification.toString();
String userName = "Nick"; String message = "Hi Nick! you have won 10 points"; ServiceAPI api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); PushnotificationService pushnotificationService = api.BuildPushnotificationService(); PushNotification pushNotification = pushnotificationService.SendPushMessageToUser(userName,message); String jsonResponse = pushNotification.ToString();
userName = "Nick"; message = "Hi Nick! you have won 10 points"; api = App42::ServiceAPI.new("<API_KEY>","<SECRET_KEY>"); pushNotificationService = api.buildPushNotificationService(); pushNotification = pushNotificationService.send_push_message_to_user(userName, message); jsonResponse = pushNotification.to_s();
$username = "Nick"; $message = "Hi Nick! you have won 10 points"; $api = new ServiceAPI("<API_KEY>","<SECRET_KEY>"); $pushNotificationService = $api->buildPushNotificationService(); $pushNotification = $pushNotificationService->sendPushMessageToUser($username,$message); $jsonResponse = $pushNotification->toString();