[英]is there a way to let an background app display something when other app is running?
for example, if i'm playing a game, a trigger will display an alert after a certain time to warn me not playing too much time and should have a rest. 例如,如果我正在玩游戏,触发器将在一定时间后显示警报,以警告我不要玩太多时间,应该休息一下。 Both android and iphone solution is welcome.
欢迎使用android和iphone解决方案。
On Android, using the following permission, 在Android上,使用以下权限,
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
you can draw views on top of any other application. 您可以在任何其他应用程序之上绘制视图。 For example, this is the permission used by the Facebook Home app to draw its chat heads .
例如,这是Facebook Home应用程序用来绘制其聊天头像的权限。
Also, this is a system permission, so it does come at a cost. 另外,这是系统许可,因此确实要付出一定的代价。
Think about it as on an Alarm Clock, which can interrupt your current App, something which is off-course possible. 想想它就像在闹钟上一样,它可以打断您当前的应用程序,这可能是偏离路线的。
Regarding Android you might want to read about AlarmManager 关于Android,您可能需要阅读有关AlarmManager的信息。
As for iPhone you might want to take a look in this Stackoverflow question discussing local notifications. 至于iPhone,您可能想看看这个讨论本地通知的Stackoverflow问题 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.