So, while Face ID prompt permission coming, I just locking and unlocking my device. app is not entering applicationDidBecomeActive and waiting for user response for that alert. So after answering the alert only app entering applicationDidBecomeActive . But for me app should enter applicationDidBecomeActive while we unlocking the phone itself.
(Note: that alert is from OS so I can't do anything that alert)
for me app should enter applicationDidBecomeActive while we unlocking the phone itself
applicationDidBecomeActive will only be called once the system prompt is dismissed, as you described, so you can't use it in order to detect screen unlock while the system prompt is still displayed.
You can do a different thing. Use a timer and repeatedly check the screen brightness. If you detect a state in which the previous brightness value was 0 and the new value is not 0, you can conclude that the screen was unlocked, even if the app is not active.
However, you will still get false positives if the screen was only tapped without being unlocked, so unfortunately this is not a complete solution.
Related
I put in a notification into my app that works just right when I want it to go off. However I put a custom sound to that notification thats is about 30 seconds long. When I am at the HOME SCREEN of my device, when the the notification + sound goes off, I re-enter the app and the sound goes away. But when I am at the LOCK SCREEN, the notification goes off but when I re-enter the app it does not turn off. WHY
I guess, you can check the notification agent, whether the program allows notifications in the background.
These are the steps where this scenario is occurring:
I deployed my app and I navigated to several screens.
Due to low battery of my device I got a low battery alert.
When I tapped dismiss button from the low battery aler, My app is automatically navigating to the Home screen (i.e first screen)
Can anyone suggest me what might be the problem.
Whenever these system dialog pops up, your app though still in forground becomes inactive. And once you dismiss it, it becomes active again. If my guess is right, you must be doing something in applicationDidBecomeActive delegate method. You simply need to check that method and fix it.
I'm confused about UIApplicationDidBecomeActiveNotification. I can register an observer for this notification, and receive signals when the app becomes active from the background or when being launched. However, when I pull down the hidden top popup view (for general information: notifications, weather, stock market) then pull up to hide it, the signal is also generated.
I use a callback method hooked with this signal to refresh my app, so this can be annoying for users of my app.
Can anybody help me differentiate these cases?
Maybe you should try UIApplicationWillEnterForegroundNotification, the apple doc has said:
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/Reference/Reference.html
UIApplicationDidBecomeActiveNotification: Posted when the application becomes active.
An application is active when it is receiving events. An active application can be said to have focus. It gains focus after being launched, loses focus when an overlay window pops up or when the device is locked, and gains focus when the device is unlocked.
I want my app to behave differently if the user pushes hardware home button, versus other reasons it may go into background. I think I have sorted out the main cases, except I can't tell the difference between user tapping on incoming push notification from another app and hitting the hardware home. In iOS 5, I was getting an applicationWillResignActive when the notify first appeared, and then applicationDidEnterBackground when the user tapped. In iOS 6, I cannot find any event triggered by the appearance of a banner notification from another app. The applicationWillResignActive and applicationDidEnterBackground come back to back, just as in hitting hardware home. I tried listening to UIWindowDidBecomeVisibleNotification and other UIWindow notification, but nothing is fired. Any ideas?
Our iOS app has its own passcode screen which is displayed to the user each time the application loads.
An additional requirement is that the passcode screen should be displayed if the user locks the screen. Initially I have used the applicationWillResignActive method within the app delegate to set the passcode view as a modal. I'm setting it on resign rather than applicationDidBecomeActive so that when iOS makes our app visible again you don't see a quick switch between views.
This works fine for when the user locks the screen but resignActive is also called when an SMS alert is recieved, which means that even if the user dismisses the notification they are asked to enter their passcode again.
Is there a way to work out if the screen has been locked, so I can respond specifically to that event?