---
title: "Hide private screens from screenshots and · Agent Wranglers"
url: https://agentwranglers.se/playbook/mobile-apps/data-on-the-device/hide-private-screens
id: MOB-47
level: Recommended
updated: 2026-10-22
build: a2a6bdfed830
tokens: 831
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Hide private screens from screenshots and the app switcher

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Data on the device](https://agentwranglers.se/playbook/mobile-apps/data-on-the-device.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-27.

- ID: MOB-47
- Level: Recommended
- Chapter: [Data on the device](https://agentwranglers.se/playbook/mobile-apps/data-on-the-device.md)
- Rule: Screens that show card numbers, one-time codes, health data or secrets are hidden from the app switcher. On Android they also block screenshots and screen sharing.
- Check: On a test device, open each private screen, go to the home screen and open the app switcher. The preview shows no private value, and an Android screenshot of the screen comes out blank.
- How: Both systems save a picture of the last screen when the app goes to the background. Screen sharing apps are also a common tool in phone fraud. On Android, set `FLAG_SECURE` on the window of each private screen. On iOS, cover the window with a plain view when the scene resigns active, and remove it when it returns. Keep the list of private screens short, since people also take screenshots for good reasons. Values shown in widgets follow [give widgets and watch apps only the data they show](https://agentwranglers.se/playbook/mobile-apps/data-on-the-device/widget-and-watch-data.md).

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### Kotlin example

```kotlin
class CardDetailsActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        window.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE)
    }
}
```

### Plain text example

```swift
func sceneWillResignActive(_ scene: UIScene) {
    guard router.isShowingPrivateScreen else { return }
    privacyCover.frame = window?.bounds ?? .zero
    window?.addSubview(privacyCover)
}

func sceneDidBecomeActive(_ scene: UIScene) {
    privacyCover.removeFromSuperview()
}
```

## Sources

- [OWASP MASVS-PLATFORM-3](https://mas.owasp.org/MASVS/controls/MASVS-PLATFORM-3/)
- [Android, Secure sensitive activities](https://developer.android.com/security/fraud-prevention/activities)

## Related rules

- MOB-39 [Give widgets and watch apps only the data they show](https://agentwranglers.se/playbook/mobile-apps/data-on-the-device/widget-and-watch-data.md) in Mobile apps

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/mobile-apps/data-on-the-device/hide-private-screens">Agent Wranglers mobile apps playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Queue offline changes and resolve conflicts on the server](https://agentwranglers.se/playbook/mobile-apps/data-on-the-device/offline-sync.md)
- [Data on the device](https://agentwranglers.se/playbook/mobile-apps/data-on-the-device.md)
