Ionic onesignal redirect page HELP!


#1

I’m trying to practice in ionic 1. I’ve added the Onesignal notification, but the user clicks the notification before going to the id that I wrote earlier.
The result is successful in the console but it does not go on clicking on the notification.

Code :

 var notificationOpenedCallback = function(jsonData) {
    alert('app.post({postId :' + JSON.parse(jsonData.notification.payload.collapseId) + '})');
      //  $state.go('/app/post/'+ JSON.parse(jsonData.notification.payload.collapseId));
$state.go('app.post({postId :' + JSON.parse(jsonData.notification.payload.collapseId) + '})');
      console.log('notificationOpenedCallback: ' + JSON.stringify(jsonData));
     };

 window.plugins.OneSignal
  .startInit("61a009fc-d388-4107-b304-6caa565d7f3f")
  .handleNotificationOpened(notificationOpenedCallback)
  .endInit();

#2

there is something wrong with your ui router. Can you share your ui router code


#3

I have reviewed my codes and made some changes. I am sending my codes with my recent changes. Would you please examine it? I did not fix the issue of routing notifications.
Onesignal push notifications connsole working but in app not working

latest onesignal code :

var notificationOpenedCallback = function(jsonData) {
    alert('app.post({postId :' + JSON.parse(jsonData.notification.payload.collapseId) + '})');
      //  $state.go('/app/post/'+ JSON.parse(jsonData.notification.payload.collapseId));
          //      $state.go('app.post({postId :' + JSON.parse(jsonData.notification.payload.collapseId) + '})');
      console.log('notificationOpenedCallback: ' + JSON.stringify(jsonData));
     };
     window.plugins.OneSignal
      .startInit("61a009fc-d388-4107-b304-6caa565d7f3f")
      .handleNotificationOpened(notificationOpenedCallback)
      .endInit();

I will export the google drive link because the app.js and controller,js file is too long
App.js === https://drive.google.com/open?id=0B0cA5rUOjusiOWNfaHU5UGVodzA
Controller,js === https://drive.google.com/open?id=0B0cA5rUOjusiUXNMRUdpX2FuXzQ


#4

.state(‘app.post’, {
url: “/post/:postId”,
where is the parent page for “posts”


#5

state.go() change>> state.url() …
is correct ??


#6

Your URL is post/:postid which means there should be a posts page containing all the items and your postid is one of them.