When adding notifications to your iOS app using the WP-AppKit Pushwoosh Addon, you may need to know your device push token.

If you use Xcode you can get it from your app logs, as explained here: http://docs.pushwoosh.com/docs/ios-faq#how-do-i-obtain-my-ios-device-push-token-to-use-in-test-devices

If you don’t use Xcode, you can get it by using the cordova pushwoosh plugin api function “getPushToken()” that you’ll have to (temporarily) add directly to your app javascript code (in your WP-AppKit theme’s functions.js), as follows:

if ( typeof cordova !== 'undefined' ) {
        var pushNotification = cordova.require( 'pushwoosh-cordova-plugin.PushNotification' );
        pushNotification.getPushToken(
                function( token ) {
                        alert( 'Push token: ' + token );
                }
        );
}

This will display your push token when you launch your built app on your device, provided you have the PushWoosh Addon activated for the app and correctly configured iOS push certificates.

Published by Mathieu on December 12, 2017

Freelance Senior Web Developer, WordPress since 2009, JS/Backbone since 2012, Custom Back-End devs, WebApps and Plugins for clients and the community.

Leave a Reply

Your email address will not be published. Required fields are marked *

Having questions?

FAQ | Tutorials | Documentation

Or

Contact Us