{{tag>Manuals How_To Mobile Notifications}} [<10>] ====== How to send push notifications to a mobile phone ====== Sending push notifications to mobile phones is only supported for native mobile applications. If you want to send push notifications to mobile phones in your native mobile applications there are several major steps involved. Most of them need only to be done once, so don’t be put off by the details described below. - Setup Apple and Google pre-requisites (for iOS and Android phones) – this should only be done once. - Enter these pre-requisites into Aware IM (also done once only) - Configure push notification rules in Aware IM We will cover each of these steps in detail. ===== Step 1 (Apple). Setup iOS pre-requisites ===== - In order to use iOS push notifications you need a certificate. - In order to build native iOS applications using PhoneGap you also need a certificate and a provisioning profile file. - Before you can generate certificates and provisioning profile you need to enter your Apple Developer account here [[https://developer.apple.com/account/#/welcome|]] - You can just sign in using your Apple ID. - Then you need to join Apple Developers Program here: - [[https://developer.apple.com/programs/|]] - Once you have enrolled into this program you can generate certificates and provisioning profile for the PhoneGap build. Follow the instructions here: [[https://coderwall.com/p/eceasa/getting-everything-for-building-ios-apps-with-build-phonegap-com|]] - To generate the certificate. Follow the instructions here: [[https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/AddingCapabilities/AddingCapabilities.html#//apple_ref/doc/uid/TP40012582-CH26-SW11|]] ===== Step 1 (Google). Setup Android pre-requisites ===== - Create a project here [[https://console.firebase.google.com/|]] - Create an Android application for your project - Go to the Application Settings (General tab) and download the file google-services.json. Keep this file in a safe location - Go to the Cloud Messaging tab in application settings and copy the Services Key ===== Step 2. Enter iOS and Android pre-requisites in Aware IM ===== - In the Configuration Tool, double click on the Business Space Version you want to change and click on "Push Notifications" property in the list of version properties. - A dialog will popup. In the “APNS” section of this dialog enter the full path to the iOS certificate file on your machine and certificate password. - In the FCM Settings section of the dialog enter the location of the google-services.json file and enter the Services Key - Once you click OK Aware IM will automatically add one predefined business object (MobilePhone) and one predefined notification MobilePushNotification to your business space version. ===== Step 3. Configure push notification rules in your application ===== a) First you need to make sure that the owner of the phone subscribes to push notifications. You will need a process for this. The process should use the ''[[a_f:a:mobile_subscribe|MOBILE SUBSCRIBE]]'' action. After this action has been executed a new instance of the MobilePhone object will be added to the context of the process. It is this object that the notification will be sent to. So most of the time it makes sense to associate this object with the logged in user. You can add a reference to the user object that will store one or several phones that the user owns. The process can then look like this: MOBILE SUBSCRIBE LoggedInRegularUser.MobilePhone = MobilePhone or MOBILE SUBSCRIBE INSERT MobilePhone in LoggedInRegularUser.Phones) b) To send push notifications you need to create another process that uses the [[a_f:a:mobile_push|MOBILE PUSH]] action. The process should find all MobilePhone objects that it wants to send the notifications to and use the ''MobilePushNotification''. For example: FIND ALL MobilePhone CREATE MobilePushNotification WITH MobilePushNotification.Title='Test', MobilePushNotification,Subject='This is my test notification', MobilePushNotification.Sound='default' MOBILE PUSH MobilePushNotification TO MobilePhone