简体   繁体   English

Android - 当前应用程序处于前台时阻止其他应用程序读取NFC

[英]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.

相关问题 当我的应用程序在前台时,如何防止其他应用程序读取 NFC 标签? - How to prevent other apps to read NFC tags when my app is in foreground? 我想在我的Android应用程序处于前台时隐藏其他应用程序的所有通知。 这可能吗? 怎么样? - I want to hide all notifications of other apps when my Android app is in foreground. Is this possible? How? 从 android 中的其他应用程序共享对话框启动前台服务 - Start foreground service from other apps share dialog in android 从 Android 12 中的最近应用程序中删除应用程序时,音乐播放器前台服务停止 - Music Player Foreground service Stops when App is removed from recent apps in Android 12 关于Android,如何防止其他应用读取我的联系人 - About Android, how to prevent other apps reading my contacts 检测其他可以访问 android 中的 NFC 模块的应用 - Detect other apps with access to NFC module in android android-从最新应用中删除的应用取消了前台通知 - android - foreground notification is cancelled on app removed from recent apps 在Android中-当应用程序处于前台时如何防止Firebase推送通知? - In android - How to prevent Firebase push notification when app is in foreground? 从最近的应用程序中删除应用程序时,“前台”服务将被终止 - “foreground” service is killed when App is removed from recent apps android阻止后台应用程序在前台启动活动 - android Prevent a background app from launching activities in the foreground
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM