Our company is now using Unity 3D for a couple of major games in development and it became clear we wanted to benefit from this amazing work done by Pushwoosh team. It requires minimum efforts on our side and delivers functionality which is essential for most of the gaming projects.

Olga Zobova

Head of Mobile Games Publishing

Alawar Entertainment

READ TESTIMONIAL

Appcelerator Titanium iOS Push Notification

To integrate Pushwoosh into your Appcelerator Titanium iOS application you need to do simple following steps:

1. Download the following script and place it in your Resources folder (the folder where app.js is located):

https://github.com/shaders/push-notifications-sdk/blob/master/SDK%20Sample%20Projects/Appcelerator%20Titanium/iOS/Resources/pushwoosh.js

2. Include the following line in your app.js. Replace ‘YOUR_PUSHWOOSH_APP_CODE’ with your Pushwoosh application code from the control panel.

Ti.include('pushwoosh.js');
PushWoosh.appCode = 'YOUR_PUSHWOOSH_APP_CODE';

3. Registering and handling push notifications. On start of the application call the following function:

	Ti.Network.registerForPushNotifications({
		types : [Ti.Network.NOTIFICATION_TYPE_BADGE, Ti.Network.NOTIFICATION_TYPE_ALERT, Ti.Network.NOTIFICATION_TYPE_SOUND],
		success : function(e) {
			var deviceToken = e.deviceToken;
			Ti.API.info('successfully registered for apple device token with ' + e.deviceToken);

			PushWoosh.register(function(data) {
				Ti.API.debug("PushWoosh register success: " + JSON.stringify(data));
			}, function(e) {
				Ti.API.warn("Couldn't register with PushWoosh: " + JSON.stringify(e));
			});
		},
		error : function(e) {
			Ti.API.warn("push notifications disabled: " + JSON.stringify(e));
		},
		callback : function(e) {
			Ti.API.warn("push message received: " + JSON.stringify(e));

			//send stats to Pushwoosh about push opened
			PushWoosh.sendPushStat(e.data.p);

			var a = Ti.UI.createAlertDialog({
				title : 'New Message',
				message : e.data.alert
				//message : JSON.stringify(e.data)	//if you want to access additional custom data in the payload
			});
			a.show();
		}
	});

4. Expert mode on!

Tags (please note the device have to be registered with Pushwoosh before calling this method):

				PushWoosh.setTags({alias:"device1"}, function(data) {
						Ti.API.debug("PushWoosh sendTags success: " + JSON.stringify(data));
					},function(e) {
						Ti.API.warn("Couldn't setTags with PushWoosh: " + JSON.stringify(e));
				});

Stats:

call this function on start to track application open stat

//record stats for app open with Pushwoosh
PushWoosh.sendAppOpen();

call this function in your push notifications handler to track opened push notifications count:

//send stats to Pushwoosh about push opened
PushWoosh.sendPushStat(e.data.p);

Auto badges

In order to make auto badges work, every time you change badge value in your app call the following function:

//notifies Pushwoosh about current badge value
PushWoosh. sendBadge(5);

If you have any problems, check out Appcelerator Titanium push notifications sample app:

https://github.com/shaders/push-notifications-sdk/tree/master/SDK%20Sample%20Projects/Appcelerator%20Titanium/iOS

NOTE: iOS Simulator is not able neither to subscribe nor receive push notifications.