[TIMOB-5437] iOS: Expose applicationState property of UIApplication Class
GitHub Issue | n/a |
---|---|
Type | New Feature |
Priority | High |
Status | Closed |
Resolution | Duplicate |
Resolution Date | 2013-02-14T00:57:16.000+0000 |
Affected Version/s | Release 1.7.2 |
Fix Version/s | 2013 Sprint 04 API, 2013 Sprint 04 |
Components | iOS |
Labels | SupportTeam |
Reporter | Eduardo Gomez |
Assignee | Sabil Rahim |
Created | 2011-10-05T06:39:36.000+0000 |
Updated | 2017-03-22T22:08:05.000+0000 |
In regards to the original need for exposing this state for remote notifications: It seems that it may not possible to correctly inspect this state as specified in apple's documentation: "application:didReceiveRemoteNotification:" in the 'callback' method of the push notification handler. Specifically, if we inspect the application state property within the push message callback, it may always return UIApplicationStateActive. Perhaps this is because the javascript push message handler gets invoked asynchronously after the didReceiveRemoteNotification has returned? For this particular problem, it doesn't make sense to expose the applicationState if this problem is not fixed. I am going to perform additional tests to see if I can verify that this is in fact the behavior.
Nevermind my previous comment. The applicationState is in fact correct when receiving the push message callback within javascript. That is, when the app is in the background, and the javascript callback is invoked, the applicationState is inactive. When it is in the foreground, the applicationState is active. Exposing the applicationState should enable an application developer to determine if the app was in the background or foreground when the push message was originally received.
Duplicate of TIMOB-3528
This Ticket should be reopened. It is currently not possible to detect the difference between a home button press and a sleep button press through events on ios. For IOS lower than 5.0 this was possible because ONLY the pause event fired for a sleep button press whereas BOTH the pause and paused events fired for a home button press. Since 5.0 the same events fire for both of these situations and the only way to tell the difference between the two is to inspect the applicationState property. See http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.App An example of an app that needs this is one that plays audio in the background. When the screen is locked, the audio should continue to play, but when the user deliberately navigates away from the app, the audio should be stopped or paused. Please let me know that you acknowledge this comment or I will have to assume it is lost (due to being on a closed issue) and I will create a new issue with the same details. Regards, Ben
Closing ticket as duplicate and links to the related ticket have been provided above.