CHROME PUSHES - THE NEW FORCE AWAKENS Bullet

What’s nice about Pushwoosh is they have a free offering with basic push features to get you started and their service applies to multiple platforms in general as well as offering plugins and samples for PhoneGap applications targeting iOS, Android, and Windows Phone 7. I noticed there also appears to be a plugin available and supported with PhoneGap Build. With all the PhoneGap support it seemed like a great service to blog about in addition to my recent push notification posts.

...

I was very impressed with the support I received while trying out this service. They were quick to respond with meaningful information and went out of their way to add some additional code to aid in some specific testing I was doing to try out their geozones offering which I will be posting about specifically next.

Holly Schinsky

Senior Application Developer

www.devgirl.org

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.
Pushwoosh https://www.pushwoosh.com/wp-content/themes/pushwoosh/img/logo.png support@pushwoosh.com