排除带有 NFC 的非 NXP Android 手机(如 Nexus 4/10)

Exclude non-NXP Android phones with NFC (like the Nexus 4/10)(排除带有 NFC 的非 NXP Android 手机(如 Nexus 4/10))
本文介绍了排除带有 NFC 的非 NXP Android 手机(如 Nexus 4/10)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经构建了一个应用程序,可以从我们学校使用的学生证中读取某些数据.目前它只读取用户数据,但未来计划是增加对读取剩余信用的支持.

I've built an app that reads out certain data from the student ID cards our school uses. Right now it only reads user data but in the future the plan is to add support to read the remaining credit.

问题是我们使用的卡是 Mifare Classic.Nexus 4 和 Nexus 10(可能还有更多设备)不支持这些卡,因为它们具有 Broadcom NFC 控制器.如果我是对的,那么应用程序不应该在这些设备上崩溃或出现问题,但它什么也不做.

The problem is that the cards we use are Mifare Classic. Nexus 4 and Nexus 10 (and possibly more devices) don't support these cards since they have a Broadcom NFC controller. If I'm right the app shouldn't crash or give issues on those devices, but it just doesn't do anything.

有没有办法在没有 NXP 控制器的情况下排除这些设备?(基本上就像 MifareClassic 类所需的使用功能.)我可以通过 Play 商店排除 Nexus 4 和 10,但仅此而已几乎不是一个好的解决方案 - 更何况其他设备可能会开始使用 Broadcom 控制器,并且必须手动排除它们.

Is there a way to somehow exclude these devices without NXP controller? (Basically like uses-feature required for the MifareClassic class.) I can exclude the Nexus 4 and 10 through the Play Store but that's hardly a good solution - even more because other devices might start using Broadcom controllers and they'd all have to be excluded manually.

谢谢!- 安布鲁斯

推荐答案

您可以按如下方式签入您的应用以获得 MIFARE Classic 支持:

You can check in your app for MIFARE Classic support as follows:

boolean hasMifare(Context ctx) {
 return ctx.getPackageManager().hasSystemFeature("com.nxp.mifare");
}

在安装应用程序之前无法进行检查.但安装后,您可以警告用户您的应用的功能将受到限制,因为缺少 MIFARE Classic 支持.

There is no way to check for this before installing the app. But after installation, you can warn the user that the functionality of your app will be limited, because of the lack of MIFARE Classic support.

这篇关于排除带有 NFC 的非 NXP Android 手机(如 Nexus 4/10)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)