简体   繁体   English

使用NFC功能从Android访问Web应用程序

[英]Access web application from android with NFC feature

I have developed web application to read/write NFC, for card reader i am using ACR122U. 我已经开发了用于读取/写入NFC的Web应用程序,用于读卡器,我正在使用ACR122U。 Now i want to access my web application from android application by using card reader from android device. 现在,我想通过使用Android设备上的读卡器从Android应用程序访问我的Web应用程序。

Is it possible if i still use web application? 如果我仍然使用Web应用程序,是否可以? or i must develop again with native application android? 还是我必须使用本机应用程序android重新开发?

Thanks. 谢谢。

Not sure how your Web app is talking to the reader (presumably some ActiveX, etc. is exposing an API to PC/SC), but Android doesn't give you direct access to the NFC reader. 不确定您的Web应用如何与阅读器通信(大概是某些ActiveX等正在向PC / SC公开API),但是Android不允许您直接访问NFC阅读器。 You have to implement an activity that gets notified when a tag comes in range. 您必须实现一个活动,当标签进入范围时,该活动将得到通知。 In short, your Web app most probably won't work as is. 简而言之,您的Web应用很可能无法按原样工作。

You can use something like this present the phone as an external reader to your server, but it requires custom firmware: 您可以使用如下所示的方式将手机作为服务器的外部读取器,但是它需要自定义固件:

https://code.google.com/p/seek-for-android/wiki/BTPCSC https://code.google.com/p/seek-for-android/wiki/BTPCSC

I have been researching the same thing. 我一直在研究同一件事。 Have you tried PhoneGap's NFC plugin? 您是否尝试过PhoneGap的NFC插件? http://phonegap.com/2011/09/26/building-an-nfc-enabled-android-application-with-phonegap/ http://phonegap.com/2011/09/26/building-an-nfc-enabled-android-application-with-phonegap/

I have not used PhoneGap before and have not had good feedback from people who did. 我以前没有使用过PhoneGap,也没有得到过使用过的人的好评。 Let me know how you get along if you choose this option. 如果您选择此选项,请告诉我您的情况。

You need to bridge javascript into Android code, then write all the layer that will handle the tag. 您需要将javascript桥接到Android代码中,然后编写将处理该标记的所有层。 I suggest you use Android NFC APIs directly, not PCSC, because Seek's PC/SC will not be able to target your tag, it is meant for secure elements (embedded, SD, SIM) and not for driving tags. 我建议您直接使用Android NFC API,而不要使用PCSC,因为Seek的PC / SC将无法定位您的标签,它用于安全元素(嵌入式,SD,SIM),而不用于驱动标签。 Depending on your tag's technology, the code might look quite different, but you might be able to reuse some of your code. 根据标签的技术,代码看起来可能完全不同,但是您可以重用某些代码。

The phonegap approach might work (depending on how well the adaptation layer handles your tag, but seems limited, and will impose some code changes on you web application. phonegap方法可能会起作用(取决于适配层对标签的处理方式,但似乎很有限,并且会在您的Web应用程序上施加一些代码更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM