Steps To Integrate Push Notification With Unity3d On Ios-masa-c

Implementing Push Notifications in Unity Apps/games for iOS is an easy task and will explain the process of doing this through a sample unity demo App. The source code can be downloaded or viewed from our GitHub Repo.push with unity ios Steps to Integrate Push Notification with Unity3d on iOS To configure Push Notifications for iOS Apps/games; the prerequisites are: Create a new App ID and provisioning profile for each App that uses push, as well as a SSL certificate for the server. To do this you should have an iOS Developer Program membership on iOS Dev Center. Create .p12 file from the SSL certificate which was downloaded in the above step from the iOS Dev Center. A Server and this is where App42 Push Service comes into the picture. Note: If you are new to Push Notifications for iOS or App42 , you can go through my previous blog first. Now lets understand how the sample code implements the Push Notifications by examining the key code snippets. Open the folder which you downloaded and go to assets folder and double click PushSample.unity file to open the sample. To implement Push just drag and drop our App42PushHandlerInternal.h/.m classes to Assets/Plugins/iOS folder and PushScript.cs C# script to Assets folder. Assign PushScript.cs to a game object; in the demo it was assigned to the Main Camera. So, lets browse through the PushScript.cs code. To receive push notifications, the iOS needs to be notified that your App wants to receive push notifications, and App42PushHandlerInternal.m class does it by default . In the PushScript, all the required callbacks are defined and to get it called, set a listener game object as: 1 // Use this for initialization 2 void Start () 3 { 4 setListenerGameObject(; 5 } As App42PushHandlerInternal.m sends a request to register this device for push notification service; the device token is received from Apple Push Service on the successful response. It is available via onDidRegisterForRemoteNotificationsWithDeviceToken call back of PushScript.cs. 1 //Sent when the application successfully registered with Apple Push Notification Service (APNS). 2 void onDidRegisterForRemoteNotificationsWithDeviceToken(string deviceToken) 3 { 4 if (deviceToken != null && deviceToken.Length!=0) 5 { 6 registerDeviceTokenToApp42PushNotificationService(deviceToken,"User Name"); 7 } 8 } Now you need to register this device to App42 Push Notification Service to start sending/receiving push notifications. To do that, just call registerDeviceTokenToApp42PushNotificationService method of PushScript.cs from the above call back. 1 //Registers a user with the given device token to APP42 push notification service 2 void registerDeviceTokenToApp42PushNotificationService(string devToken,string userName) 3 { 4 ServiceAPI serviceAPI = new ServiceAPI(api_key,secret_key); 5 PushNotificationService pushService = serviceAPI.BuildPushNotificationService(); 6 pushService.StoreDeviceToken(userName,devToken,"iOS"); 7 } The SendPushToUser method of this script that can be written/called wherever its required to send a request to App42 server to send a Push Notification to a specific user. 1 //Sends push to a given user 2 void SendPushToUser(string userName,string message) 3 { 4 ServiceAPI serviceAPI = new ServiceAPI(api_key,secret_key); 5 PushNotificationService pushService = serviceAPI.BuildPushNotificationService(); 6 pushService.SendPushMessageToUser(userName,message ); 7 } The onPushNotificationsReceived call back of the PushScript will be called when you receive a push notification. 1 //Sent when the application Receives a push notification 2 void onPushNotificationsReceived(string pushMessageString) 3 { 4 Console.WriteLine("onPushNotificationsReceived"); 5 //dump you code here to handle the pushMessageString 6 Debug.Log(pushMessageString); 7 } Now your App has been successfully set up to receive/send push notifications through our App42 Server using App42 Push Notification Service. If you have any questions or need any further assistance to integrate this in your App, please feel free to write us at About the Author: Love life at ShepHertz. Entrepreneur, Social Media Enthusiast,Mobile App Lover, Internet HitchHiker, Product Manager, Developer Evangelist Article Published On: ..articlesnatch.. – Mobil-.puting Builds Smart, Professional And Innovative Websites With Get Found Uk By: sinuse – A decent approach to begin your hunt would be utilizing a Google seek. In the event that you write "Web Design Hampshire" into Google, it will think of the most suitable organization’s site that it can discover with these watchwords. When you have found a few offices that you think … Tags: Top 3 Development Tools For Undergoing Mobile .merce Application Development By: michelkein – The Smartphone being the most popular trend in the world these days wherever there is a requirement for mobility mobile .merce is widely used. The world market has accepted these mobile apps using m-.merce extensively. Tags: 3 Most Crucial Things To Take Care Of When Undergoing Iphone Development By: michelkein – The various mobile apps iPhone offers us has made our lives simplified. Thousand of apps to take care of thousands of tasks keeps the demand for development rising. Tags: Know More About Cake Php Development By: Chrome Infotech – Designing and developing a website isn’t simple. This is exactly why IT .panies are always on the lookout for new tools that help streamline the process. Tags: Benefits Of Drupal Website Development In India By: Chrome Infotech – Drupal is an absolute favorite of web developers and bloggers when it .es to content management. Tags: The Unpredictable Trends Involving Mobile App Development Technologies By: Chrome Infotech – The current mobile app development trends are shifting so drastically that sometimes it difficult for even the experts to predict the next shift. Tags: Hire Services Of Professional Android App Development .pany In India By: Chrome Infotech – Within a short span of time, Android has be.e one of the most popular mobile operating systems with a global market share of over 80% by the 2nd quarter of 2015. Tags: Overview Of Automated Testing Services By: Chrome Infotech – Testing software before deployment is an essential part of the development cycle. In every software development or app development team, a few members work as testers. Tags: Google Has Offered A Course In Android Development By: alexclark512 – There is good news for Android developers that Google has joined hands with Audacity in order to launch a free course in Android development, and it will be available for all, who have a great interest in building an Android Application. Tags: How To Get Rid Of Ads On Android Browsers And Apps By: Vivek Bisht – Here you can learn How to Get Rid of advertisements on Android Browsers and Apps just using inter. ads blocker app. Tags: 相关的主题文章: