Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Pause and Resume not firing on Android

I am trying to catch both the 'pause' and the 'resume' events. These events seem to work as expected on iOS, but they are not getting caught on Android. Has anyone been able to get this to work for them. I am testing on Android 1.6 through the emulator and using Titanium SDK 1.4.2. Here is the code I am using to listen for the events.

Ti.App.addEventListener('pause', 
    function(e) {
        Ti.API.info('Caught pause event');
});

Ti.App.addEventListener('resume', 
    function(e) {
        Ti.API.info('Caught resume event');  
});
— asked December 7th 2010 by Kevin Berry
  • android
  • event
  • mobile
  • pause
  • resume
0 Comments

2 Answers

  • Those events are iPhone only. Android does not have the concept of applications pausing and resuming only Activities. In the upcoming 1.5.0 release you can capture the native activity events for Android.

    — answered December 7th 2010 by Don Thorp
    permalink
    4 Comments
    • Thank you for you prompt response to my original question. Is it possible to get the list of the activity events that I am going to be able to catch for android. I will use the CI build in order to use this functionality. Not having the ability to catch these events is a show stopper for me.

      — commented December 7th 2010 by Kevin Berry
    • Now 1.5.0 is out, how do you catch the resume of the principal activity for an application? I tried setting an event against Ti.Android.currentActivity.resume but it didn't trigger.

      — commented December 20th 2010 by Mark White
    • Did you ever get resolution to this? I'm on 1.5.1 and not seeing these events firing on the android.

      — commented January 15th 2011 by B Ben
    • In Android, Resume & Pause event fire by following code

      // For resume
      win.activity.addEventListener('resume', function(){
          alert('App resume');
      });
      
      // For pause
      win.activity.addEventListener('pause', function(){
          alert('App pause');
      });
      

      — commented August 29th 2012 by Vijay Vavdiya
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.