Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-13339

Android: Add support for onUserLeaveHint for activities

    Details

      Description

      There isn't any good way to know if the user "pauses" an Android app. For example by hitting the home button. Listening for activity pause/resume for a multiple activity app can be really messy.

      Maybe also hook this feature into the Ti.App.pause(d) event?

      http://developer.android.com/reference/android/app/Activity.html#onUserLeaveHint()

      	var win = Ti.UI.createWindow({
      		   backgroundColor : 'red',
      		   orientationModes : [Titanium.UI.PORTRAIT],
      		   exitOnClose : true,
      		   navBarHidden : true
      		});
      	
      	win.addEventListener('open', function(){
      		win.getActivity().addEventListener('userleavehint', function()
      				{
      			Ti.API.info("Activity USER_LEAVE_HINT!!!!");
      			});
      	});
      		 
      	win.addEventListener('click', function()
      	{	
      	   var secondWin = Ti.UI.createWindow({
      	      backgroundColor : 'blue',
      	      orientationModes : [Titanium.UI.PORTRAIT],
      	      navBarHidden : true
      	   });
      	  
      	   secondWin.open();
      	});
      	win.open();
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sunila Sunila
                Reporter:
                jesper@x-com.se Jesper Jonsson
                Reviewer:
                Hieu Pham
              • Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Source Code