[英]Android - Prevent other apps from reading NFC when current app in foreground
I created an NFC app. 我创建了一个NFC应用程序。 I designed it so only one of its activities can process an NFC tag.
我设计了它,因此只有其中一项活动可以处理NFC标签。 When another activity is active (same app), and the tag is scanned, another app steals focus and sends my app to the background.
当另一个活动处于活动状态(相同的应用程序),并且标记被扫描时,另一个应用程序会窃取焦点并将我的应用程序发送到后台。 How can I prevent all other NFC apps from stealing focus while my app is running in foreground?
当我的应用程序在前台运行时,如何防止所有其他NFC应用程序窃取焦点?
You can't really. 你不能真的。 Your only option is to have all your activities use foreground dispatch to make sure your app handles the tag if it is visible.
您唯一的选择是让所有活动都使用前台调度 ,以确保您的应用处理标记(如果可见)。 You can probably use a base activity to share the code.
您可以使用基本活动来共享代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.