Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49526

APNS notification url once opened?

$
0
0

@jacksrf wrote:

How do I direct the user in the app to a specific page once they click on a background notification? I get the notification but it just opens the app coldstart or from background. How do a direct to a particular view or url?

var optionsNotification = {
  ios: {
    alert: "true",
    badge: "true",
    sound: "true"
  }
};
$cordovaPushV5.initialize(optionsNotification).then(function() {
  // start listening for new notifications
  $cordovaPushV5.onNotification();
  // start listening for errors
  $cordovaPushV5.onError();

  // register to get registrationId
  $cordovaPushV5.register().then(function(registrationId) {
    // save `registrationId` somewhere;
    $rootScope.device_token = registrationId;
    console.log($rootScope.device_token)
  })
});

$rootScope.$on('$cordovaPushV5:notificationReceived', function(event, data) {
  $rootScope.notificationData = data;
  $cordovaPushV5.finish().then(function (result) {
    $rootScope.notificationData = data;
  })
});

// triggered every time error occurs
$rootScope.$on('$cordovaPushV5:errorOcurred', function(event, e) {
  // e.message
});

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 49526

Trending Articles