No, there's no way of distinguishing in general why your app transitions to the background. There are some ways to detect, say, a phone call (CTCallCenter
in the Core Telephony framework), but there's no way to tell that the device is locked specifically.
How to Identify the specific event, when user has locked/unlocked the iPhone5 device?
-
14-01-2022 - |
Domanda
I have gone through many questions, but didn't get exactly how I'll get the lock/unlock event for iOS 5 and above.
From the various post, I understood that when user locks the screen in iOS 5 iPhone, socket connection is lost and for that we need to handle network connectivity part in background method beginBackgroundTaskWithExpirationHandler
.
But is there an exact way to handle specifically lock/unlock event on iOS?
Because applicationWillResignActive
method is called for screen locking/unlocking and other events, like exiting application by pressing home button or launching another application.
Is there any specific delegate method called only when iPhone screen is locked/unlocked?
Soluzione
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow