Reputation: 3070
Android has a permission that allows apps to "draw over other apps" with floating content (using the SYSTEM_ALERT_WINDOW
permission). Does iOS have anything similar?
Upvotes: 4
Views: 8055
Reputation: 12902
While limited this is somewhat possible by using the Screen Time APIs and the ShieldConfigurationDataSource. There is not much to be customised, but technically and it is in overlay.
class ShieldConfigurationExtension: ShieldConfigurationDataSource {
let title = "ScreenBreak"
let body = "You have restricted usage of this application. Wait for the time limit to end."
override func configuration(shielding application: Application) -> ShieldConfiguration {
// Customize the shield as needed for applications.
return ShieldConfiguration(
backgroundBlurStyle: UIBlurEffect.Style.light,
backgroundColor: UIColor.gray,
icon: UIImage(named: "sblogosmall.png"),
title: ShieldConfiguration.Label(text: title, color: .white),
subtitle: ShieldConfiguration.Label(text: body, color: .white),
primaryButtonLabel: ShieldConfiguration.Label(text: "Close", color: UIColor.black),
primaryButtonBackgroundColor: .white,
secondaryButtonLabel: nil)
}
override func configuration(shielding application: Application, in category: ActivityCategory) -> ShieldConfiguration {
// Customize the shield as needed for applications shielded because of their category.
ShieldConfiguration()
}
override func configuration(shielding webDomain: WebDomain) -> ShieldConfiguration {
// Customize the shield as needed for web domains.
ShieldConfiguration()
}
override func configuration(shielding webDomain: WebDomain, in category: ActivityCategory) -> ShieldConfiguration {
// Customize the shield as needed for web domains shielded because of their category.
ShieldConfiguration()
}
}
Check out this repository for an example: https://github.com/christianp-622/ScreenBreak
Upvotes: 1
Reputation: 318854
No, this can't be done. A user can only interact with whatever app is currently in the foreground.
Upvotes: 4