Ionic,OneSignal-Open the launchURL with in the app

I am sending a URL has parameter along with push notification.when clicked on notification,the link gets opened inside the mobile browser.I want the link to be opened within the mobile application.For that i used the following code in ionicPlatform ready as stated in documentation,

.handleNotificationOpened(function(jsonData) {
alert(“Notification opened:\n” + JSON.stringify(jsonData));
console.log('didOpenRemoteNotificationCallBack: ’ + JSON.stringify(jsonData));

Then in the console,it displays an error as window.plugins.OneSignal.startInit is not a function. can someone help me out where i am going wrong,Thank you!