Load the page as first

Hi all,

I want to load the page as first when I open via the notification alert. But the problem is that it will load first all the views. And when the view are ready then it will load the page where I navigate to when I open via the notification alert. Below is my code. You can see the init view and the init for the notification.

So how can I fix this? That the notification page will load as first and not as last?
Thank You!

initializeViews();

function initializeViews() {
	var mainView = app.views.create('.view-main', {
		url: '/',
		stackPages: true,
	});
	var searchView = app.views.create('.view-search', {
		url: '/search',
		iosDynamicNavbar: false,
		stackPages: true,
	});
	var heartView = app.views.create('.view-heart', {
		url: '/heart',
		stackPages: true,
		//iosSwipeBack: false,
	});
	
	var profileView = app.views.create('.view-profile', {
		url: '/profile',
		stackPages: true,
	});
}	



var appPush = {
   initialize: function() {
   document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
},

onDeviceReady: function() {
    this.registerForPush();		
},
	
  registerForPush: function(){
    var push = PushNotification.init({
        ios: {
            alert: "true",
            badge: "true",
            sound: "true", 
            clearBadge: "true" 
        }
    });
    
    push.on('notification', function (data) {
     app.tab.show("#tab-heart");
    --This is finally what I want to load as FIRST!
    app.views.current.router.navigate(data.additionalData.url);	
  	  
    }); 
}


appPush.initialize();
app.views.current.router.navigate(data.additionalData.url, { reloadAll: true} )
1 Like

Thanks for your answer. I try but still not working. I think because the views are loaded in init. And my push notification when deviceisready.

Maybe there is some function to detect when the app is open from push notification?
When it is open from push notification than I can say load views in another way?

The point is I want to load notification page as first, to load the app very fast.
The other views will load some data from the server. When I must wait for that the notification page will not load instantly. The notification page must be loaded very fast for the best user experience.