简体   繁体   English

如何在Android中读取磁卡

[英]How to read a magnetic card in android

We are developing an android application where user can swipe his/her magnetic card. 我们正在开发一个Android应用程序,用户可以在其中刷卡。

We need to parse the information, however there will be two scenarios to capture and handle the card input (we have connected the USB magnetic card reader): 我们需要解析信息,但是将有两种方案来捕获和处理卡输入(我们已经连接了USB磁卡读卡器):

  1. When focus is on Credit Card# textbox and user swipes his/her card we need to parse the information, need to show the card number only in the current focus field and Card Holder Name in another textbox/label. 当焦点位于“信用卡号”文本框上并且用户滑动他/她的卡时,我们需要解析信息,仅需要在当前焦点字段中显示卡号,并在另一个文本框/标签中显示卡持有人名称。

  2. If our application is running or even if it is not running and user swipes his/her card, we need to capture this information take the user to a particular activity in our application and need to pre-populate the captured information. 如果我们的应用程序正在运行,或者甚至没有运行,并且用户刷卡,我们都需要捕获此信息,将用户带到我们应用程序中的特定活动,并且需要预先填充捕获的信息。

Please let us know how to do this in both scenarios. 请让我们知道如何在两种情况下执行此操作。

The MSR100 is a fairly cheap USB HID device. MSR100是相当便宜的USB HID设备。 You can get more information, including some setup info here: 您可以在此处获取更多信息,包括一些设置信息:

http://www.posunitech.com/products_detail/&productId=73.html http://www.posunitech.com/products_detail/&productId=73.html

I'm fairly certain you can use it like a standard keyboard on android by using a USB OTG cable. 我相当确定您可以通过使用USB OTG电缆像Android上的标准键盘一样使用它。 Not all devices can use it, but it will essentially let you use many USB devices on Android. 并非所有设备都可以使用它,但是从本质上讲,它将使您在Android上使用许多USB设备。 With it, you can put your cursor in an EditText field and swipe to get the raw swipe data. 有了它,您可以将光标放在EditText字段中并滑动以获取原始滑动数据。 From there you could write a listener on the EditText field to pull back the stripe, parse it, and put the data where you want. 从那里,您可以在EditText字段上编写一个侦听器,以拉回条带,对其进行解析,然后将数据放在所需的位置。

If you want better security and less liability, I would go with an encrypted swiper that has EMV/Smart Card capability. 如果您想要更好的安全性和更少的责任,我会选择具有EMV /智能卡功能的加密刷卡器。 IDTech has their UniPay models that do these and are compatible with PC, iOS, & Android. IDTech的UniPay模型可以做到这一点,并且与PC,iOS和Android兼容。

http://www.idtechproducts.com/products/mobile-readers/176.html http://www.idtechproducts.com/products/mobile-readers/176.html

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

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