//Registers a user with the given device token to APP42 push notification service void registerDeviceTokenToApp42PushNotificationService(string devToken, string userName) { // Debug.Log ("registerDeviceTokenToApp42PushNotificationService Called"); ServiceAPI serviceAPI = new ServiceAPI(api_key, secret_key); PushNotificationService pushService = serviceAPI.BuildPushNotificationService(); pushService.StoreDeviceToken(userName, devToken, "iOS", callBack); }
// Sends push to a given user public void SendPushToUser(string userName, string message) { // Debug.Log ("SendPushToUser Called"); ServiceAPI serviceAPI = new ServiceAPI(api_key, secret_key); PushNotificationService pushService = serviceAPI.BuildPushNotificationService(); pushService.SendPushMessageToUser(userName, message, callBack); }
//Registers a user with the given device token to APP42 push notification service void registerDeviceTokenToApp42PushNotificationService(string devToken, string userName) { Debug.Log("registerDeviceTokenToApp42PushNotificationService Called"); ServiceAPI serviceAPI = new ServiceAPI(api_key, secret_key); PushNotificationService pushService = serviceAPI.BuildPushNotificationService(); pushService.StoreDeviceToken(userName, devToken, "iOS", callBack); //pushService.StoreDeviceToken(userName,devToken,com.shephertz.app42.paas.sdk.csharp.pushNotification.DeviceType.iOS); }
public void AsyncApp42Api() { ServiceAPI sp = new ServiceAPI("43f6b65747952492b5e30056ac9539ef7c50b44c4178e7c361cfa3b20ee52095", "e09348180158fb9304906d696dec68b3e2f074747a09ec93284271627f7c2599"); this.userService = sp.BuildUserService(); this.storageService = sp.BuildStorageService(); this.pushService = sp.BuildPushNotificationService(); this.socialService = sp.BuildSocialService(); }
void OnGUI() { if (Time.time % 2 < 1) { success = callBack.getResult(); } // For Setting Up ResponseBox. GUI.TextArea(new Rect(10, 5, 1300, 175), success); //========================================================================= if (GUI.Button(new Rect(50, 200, 200, 30), "Create Channel ForApp")) { pushNotificationService = sp.BuildPushNotificationService(); // Initializing PushNotification Service. pushNotificationService.CreateChannelForApp(cons.channelName, cons.description, callBack); } //========================================================================= if (GUI.Button(new Rect(260, 200, 200, 30), "Store Device Token")) { pushNotificationService = sp.BuildPushNotificationService(); // Initializing PushNotification Service. pushNotificationService.StoreDeviceToken(cons.userName, cons.deviceToken, "<Enter_your-device_type>", callBack); } //========================================================================= if (GUI.Button(new Rect(470, 200, 200, 30), "Subscribe To Channel ")) { pushNotificationService = sp.BuildPushNotificationService(); // Initializing PushNotification Service. pushNotificationService.SubscribeToChannel(cons.channelName, cons.userName, callBack); } //========================================================================= if (GUI.Button(new Rect(680, 200, 200, 30), "Send Push Message ToChannel ")) { pushNotificationService = sp.BuildPushNotificationService(); // Initializing PushNotification Service. pushNotificationService.SendPushMessageToChannel(cons.channelName, cons.message, callBack); } //========================================================================= if (GUI.Button(new Rect(890, 200, 200, 30), "SendPush Message To User")) { pushNotificationService = sp.BuildPushNotificationService(); // Initializing PushNotification Service. pushNotificationService.SendPushMessageToUser(cons.userName, cons.message, callBack); } //========================================================================= if (GUI.Button(new Rect(50, 250, 200, 30), "Send PushMessage ToAll")) { pushNotificationService = sp.BuildPushNotificationService(); // Initializing PushNotification Service. pushNotificationService.SendPushMessageToAll(cons.message, callBack); } //========================================================================= if (GUI.Button(new Rect(260, 250, 200, 30), "Send PushMessage ToAll ByType")) { pushNotificationService = sp.BuildPushNotificationService(); // Initializing PushNotification Service. pushNotificationService.SendPushMessageToAllByType(cons.message, "<Enter_your-device_type>", callBack); } //===================================###################========================================= if (GUI.Button(new Rect(470, 250, 200, 30), "Unsubscribe Device To Channel")) { pushNotificationService = sp.BuildPushNotificationService(); // Initializing PushNotification Service. pushNotificationService.UnsubscribeDeviceToChannel(cons.userName, cons.channelName, cons.deviceToken, callBack); } //===================================###################========================================= if (GUI.Button(new Rect(680, 250, 200, 30), "Unsubscribe From Channel")) { pushNotificationService = sp.BuildPushNotificationService(); // Initializing PushNotification Service. pushNotificationService.UnsubscribeFromChannel(cons.channelName, cons.userName, callBack); } //===================================###################========================================= if (GUI.Button(new Rect(890, 250, 240, 30), "Subscribe Channel With DeviceToken")) { pushNotificationService = sp.BuildPushNotificationService(); // Initializing PushNotification Service. pushNotificationService.SubscribeToChannel(cons.userName, cons.channelName, cons.deviceToken, "<Enter_your-device_type>", callBack); } //===================================###################========================================= if (GUI.Button(new Rect(50, 300, 200, 30), "Delete Device Token")) { pushNotificationService = sp.BuildPushNotificationService(); // Initializing PushNotification Service. pushNotificationService.DeleteDeviceToken(cons.userName, cons.deviceToken, callBack); } //===================================###################========================================= if (GUI.Button(new Rect(260, 300, 240, 30), "Send PushMessage ToGroup")) { pushNotificationService = sp.BuildPushNotificationService(); // Initializing PushNotification Service. IList <String> userList = new List <String>(); userList.Add(cons.userName); userList.Add(cons.userName1); pushNotificationService.SendPushMessageToGroup(cons.message, userList, callBack); } if (GUI.Button(new Rect(520, 300, 200, 30), "Schedule Message To User")) { pushNotificationService = sp.BuildPushNotificationService(); // Initializing PushNotification Service. DateTime expiryTime = DateTime.UtcNow.AddDays(1); pushNotificationService.ScheduleMessageToUser(cons.userName, cons.message, expiryTime, callBack); } }
//Sends push to a given user void SendPushToUser(string userName,string message) { ServiceAPI serviceAPI = new ServiceAPI(api_key,secret_key); PushNotificationService pushService = serviceAPI.BuildPushNotificationService(); pushService.SendPushMessageToUser(userName,message); }
//Registers a user with the given device token to APP42 push notification service void registerDeviceTokenToApp42PushNotificationService(string devToken,string userName) { ServiceAPI serviceAPI = new ServiceAPI(api_key,secret_key); PushNotificationService pushService = serviceAPI.BuildPushNotificationService(); pushService.StoreDeviceToken(userName,devToken,"iOS"); }