
- iOS Tutorial
- iOS - Home
- iOS - Getting Started
- iOS - Environment Setup
- iOS - Objective-C Basics
- iOS - First iPhone Application
- iOS - Actions and Outlets
- iOS - Delegates
- iOS - UI Elements
- iOS - Accelerometer
- iOS - Universal Applications
- iOS - Camera Management
- iOS - Location Handling
- iOS - SQLite Database
- iOS - Sending Email
- iOS - Audio & Video
- iOS - File Handling
- iOS - Accessing Maps
- iOS - In-App Purchase
- iOS - iAd Integration
- iOS - GameKit
- iOS - Storyboards
- iOS - Auto Layouts
- iOS - Twitter & Facebook
- iOS - Memory Management
- iOS - Application Debugging
- iOS Useful Resources
- iOS - Quick Guide
- iOS - Useful Resources
- iOS - Discussion
How to detect user pressing HOME key in iOS?
It is very important to know when user is pressing home key as it puts the application to background, here we will be seeing how to identify or get a call when user presses home key.
In you AppDelegate.swift, there are delegates methods.
Open your AppDelegate.swift and in applicationWillResignActive(_ application: UIApplication) and applicationDidEnterBackground(_ application: UIApplication), write print statement and put a breakpoint as shown.
Run the application, once the app is launch tap the home button, applicationWillResignActive will be called and then applicationDidEnterBackground.
- Related Articles
- How to detect user pressing Home Key in an Activity on Android?
- How to detect user inactivity for 5 seconds in iOS?
- Execute a script when a user is pressing a key in HTML?
- How to detect pressing Enter on keyboard using jQuery?
- How to detect a long press in iOS?
- How to Detect User Timezone in JavaScript?
- How to Detect User Timezone in PHP?
- How to hide the keyboard in Swift by pressing the return key?
- Detect home button press in android
- How to detect user inactivity for 5 seconds in Android?
- How to detect if an iOS application is in background or foreground?
- How to detect iOS device UDID, Name, Version, Model by programmatically?
- How to detect which iOS version is running on the device?
- How to detect Android user agent type in general using kotlin?
- How do detect Android user agent type in general?

Advertisements