I am using parse to send push notifications and my mobile app is based out of Ionic(angularjs). I am currently sending push notifications through channels. If I want to open specific page when user clicks on notification, how do I do? My current code is
window.parsePlugin.initialize('waDzmmDVt7hNmRCoY50wOFN3lsRoW2xu42WrPYLs', 'IF2RHNA0slYDq8feUhweewmcK2uEnOqDnK8J7jUf', function() {
console.log('Parse initialized successfully.');
window.parsePlugin.subscribe('SampleChannel', function() {
console.log('Successfully subscribed to SampleChannel.');
window.parsePlugin.getInstallationId(function(id) {
// update the view to show that we have the install ID
console.log('Retrieved install id: ' + id);
}, function(e) {
console.log('Failure to retrieve install id.');
});
}, function(e) {
console.log('Failed trying to subscribe to SampleChannel.');
});
}, function(e) {
console.log('Failure to initialize Parse.');
});
you need to register a callback
https://github.com/aaronksaunders/dcww/blob/master/www/js/parseService.js#L60
registerCallback: function (_pushCallback) {
var deferred = $q.defer();
$window.parsePlugin.registerCallback('onNotification', function () {
$window.onNotification = function (pnObj) {
_pushCallback && _pushCallback(pnObj);
alert('We received this push notification: ' + JSON.stringify(pnObj));
if (pnObj.receivedInForeground === false) {
// TODO: route the user to the uri in pnObj
}
};
deferred.resolve(true);
}, function (error) {
deferred.reject(error);
});
return deferred.promise;
}
see the complete example here : https://github.com/aaronksaunders/dcww