Notification OK button problem

You must Login before you can answer or comment on any questions.

Hello

I am creating local notification.Whenever i setup my timer it pop up's alert correctly at right time.But it opens same page where i have done setup of the notification.For eg. , It will open "notification.js" file which is creating notifications.But i want to open some other page like 'info.js' on click of 'OK' button.I have spent so many hours but no solution yet.My code is:-

var notification = Ti.App.iOS.scheduleLocalNotification({ alertBody:"Breakpal was put in background", alertAction:"ok", sound:"hello4.mp3", date:new Date(new Date().getTime() + 3000) // 3 seconds after backgrounding });

Thank you.

1 Answer

When you click the ok button on a local notification, all that does is bring the background application to the foreground. That means it will display the last page that you were on when you left the app. If you want to move to a different page, you can listen for the resume event and handle accordingly. For instance, if you want to show the info tab on resume, then programmatically switch tabs in the resume event listener.

— answered 10 months ago by Anthony Decena
answer permalink
3 Comments
  • Thank you for your response.Yes you are right.We can do in this way.But the problem is i am not using tab bar.I am using navigation control only.I want to switch to another window.How i can open another window?

    Thank you.

    — commented 10 months ago by vivek dharmani

  • The same way you would if the user had clicked on something and you wanted to open another window.

    navGroup.open(myInfoWin, {animated:true});

    — commented 10 months ago by Anthony Decena

  • I am using this code.It's working fine on simulator.But on real device it's not doing proper navigation.

    var win20 = Titanium.UI.createWindow();
     var win1 = Titanium.UI.createWindow({
          title:"Home",
         modal:1,
         url:'main_windows/mywin1.js',
      });
     var nav = Titanium.UI.iPhone.createNavigationGroup({
         window: win1
     });
      win20.add(nav);
    win20.open();
     
            var win2 = Titanium.UI.createWindow({
                 url:'main_windows/vdo.js',
            title:'Video List',
                modal:1,
                backgroundColor:'#fff',
             });
     
        nav.open(win2, {animated:true});

    — commented 10 months ago by vivek dharmani

Your Answer

Think you can help? Login to answer this question!