I almost finish integrate with ionic.io push notifications and i have some questions

Hi :smile:

I just finished my integration with ionic.io push notifications.

First thing i have to say is that the integration was very quick and easy and Ionic Team made an amazing work!

It would be nice to get an option to mention the userId (from the $ionicUser.identify) instead of mention the deviceToken itself.

On notification callback is very confusing, the interface of the object is changing between platorm.
Checkout my code:

// Register with the Ionic Push service.
$ionicPush.register({
    canShowAlert: true,
    canSetBadge: true,
    canPlaySound: true,
    canRunActionsOnWake: true,
    onNotification: function(notification) {
        // This is not a notification,
        // just notify that the user registered to push notifications
        if (notification.event == "registered") {
            return true;
        }

        // Handle notification in android and browser
        if (notification.event == "message") {
            handlePushNotification(
                notification.message, 
                notification.payload.payload.$state,
                notification.foreground
            );
            return false;
        }

        // Handle notification in IOS
        handlePushNotification(
            notification.alert, 
            notification.$state,
            notification.foreground == "1"
        );
        return false;
    }
});

Checkout my ruby server side:

headers = {
	'Content-Type' => 'application/json',
	'X-Ionic-Application-Id' => ENV['IONIC_APP_ID'],
	'Authorization' => "Basic #{Base64.encode64(ENV['IONIC_APP_SECRET']).gsub!("\n", '')}"
}
notification_data = {
	tokens: [
		"..."
	],
	notification: {
		alert: "My Message",
		ios: {
			badge: 1,
			sound: "ping.aiff",
			expiry: 1423238641,
			priority: 10,
			contentAvailable: true,
			payload: {
				"$state" => "app.stateToGo"
			}
		},
		android: {
			collapseKey: "foo",
			delayWhileIdle: true,
			timeToLive: 300,
			payload: {
				"$state" => "app.stateToGo"
			}
		}
	}
}
result = HTTParty.post(
	ENV['IONIC_PUSH_SERVER'],
	body: notification_data.to_json,
	headers: headers
)

Some problems/questions i have:

  • On android, push notification arrive, but there is now icon, super weird…
    From where is it take the icon? from the local resources? from the ionic.io saved image? how is it works?
  • Customisations, what are this fields say? ios [expiry, priority, contentAvailable] android[collapseKey, delayWhileIdle, timeToLive]
  • Is there any other attributes i can use to create more customisations?
  • In android notifications there is many options for customisations. I want that the notification will be able to show different images then the default icon. maybe even allow some interactions with the notifications like having buttons there.

Thanks :smile: