1

I have received push notification using FCM plugin. when i m clicking on notifiation, app splash screen was open but i but open another screen. how can i do it? please help.

app.js

.run(function ($ionicPlatform, $rootScope, $state) {
$ionicPlatform.ready(function() {
    if(window.cordova) {
        FCMPlugin.onNotification(
            function(data){
              $rootScope.notificationData = data;
                    $rootScope.reciveMessage(data);
                        $state.reload();
                if(data.wasTapped){
                   // $state.go('message', {id:data.pageId});
                  // $location.path('app/userList');
                    console.log('onNotification tapped true');
                } else {
                    console.log("xxxxxxxxxxxx"+data.message);
                }
            },
            function(msg){
             // alert("asdf"+msg)
                console.log('onNotification callback successfully registered: ' + msg);
                FCMPlugin.getToken(
                 function(token){
                   //alert(token);
                   window.localStorage.setItem("deviceId",token)
                 },
                 function(err){
                   console.log('error retrieving token: ' + err);
                 }
               )
            },
            function(err){
             // alert("fjkjg"+err)
                console.log('Error registering onNotification callback: ' + err);
            }
        );
    }
});

})

Sakshi
  • 151
  • 7

0 Answers0