https://github.com/realtime-framework/titaniumpush
Titanium example for a cross-platform Realtime app using push notifications from GCM and APNS
https://github.com/realtime-framework/titaniumpush
Last synced: 6 months ago
JSON representation
Titanium example for a cross-platform Realtime app using push notifications from GCM and APNS
- Host: GitHub
- URL: https://github.com/realtime-framework/titaniumpush
- Owner: realtime-framework
- License: mit
- Created: 2015-06-17T17:22:28.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-06-17T17:37:59.000Z (almost 10 years ago)
- Last Synced: 2023-08-04T19:03:23.939Z (almost 2 years ago)
- Language: JavaScript
- Size: 14 MB
- Stars: 5
- Watchers: 5
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Titanium Push Notifications with Realtime
This project shows how to build an Android and iOS Titanium app able to receive push notifications. This project uses the Realtime Titanium modules and Push Notifications from GCM and APNS.## Realtime + Android push notifications guide
- Create a Google project, more info [here](http://messaging-public.realtime.co/documentation/starting-guide/mobilePushGCM.html).
- Set the notification title to be displayed in the notification manager:
ortc.setNotificationTitle('[App name for example]');
- Before connect set your Google Project Number:
ortc.setGoogleProjectId('462540995476');
ortc.clusterUrl = 'http://ortc-developers.realtime.co/server/2.1';
if(taAuthToken.value != '') {
ortc.connect(taAppKey.value, taAuthToken.value);
} else {
ortc.connect(taAppKey.value);
}
- Set the onNotification eventListener:ortc.addEventListener('onNotification', function(e) {
addRowToEvents('(onNotification Channel: '+e.channel+') Message received: '+e.message+' Payload received: '+e.payload);
Titanium.API.log('(onNotification Channel: '+e.channel+') Message received: '+e.message);
});
- Use subscribeWithNotifications to subscribe the channel:
ortc.subscribeWithNotifications(taChannel.value, true);
- Add the following entries to your application TiApp.xml, replace **[Titanium project identifier]** :
//detect if app is running from service
## Realtime + iOS push notifications guide
- Setup iOS push notifications on iOS Dev Center, more info [here](http://messaging-public.realtime.co/documentation/starting-guide/mobilePushAPNS.html).
- Include 'co.realtime.ortc.apns.js' in your Titanium project.
- Set the onNotification eventListener:
ortc.addEventListener('onNotification', function(e) {
addRowToEvents('(onNotification Channel: '+e.channel+') Message received: '+e.message+' Payload received: '+e.payload);
Titanium.API.log('(onNotification Channel: '+e.channel+') Message received: '+e.message);
});
- Use subscribeWithNotifications to subscribe the channel:
ortc.subscribeWithNotifications(taChannel.value, true);
- On your run configuration set the application provision profile.