iOS

The primary hardware button of concern on iOS devices is the Home button. This button immediately moves any app presently running to the background. The viewWillDisappear:, applicationWillResignActive:, and applicationDidEnterBackground: methods will all be called. Plan your app so that this action will not cause problems.

Both Android and iOS have a button that puts the device to sleep or reboots it. This action also must be handled. Fortunately, the same methods that put the app in the background for other actions are executed so, typically, no additional programming is required to prepare for this.

Get Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.