chariotsolutions的PhoneGap的NFC插件意图 [英] chariotsolutions phonegap-nfc plugin intent

查看:352
本文介绍了chariotsolutions的PhoneGap的NFC插件意图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用chariotsolutions的PhoneGap的-NFC插件。阅读而应用程序正在运行一个NFC标签是没有问题的。我注册意向的应用程序,所以在启动时应用程序是在后台和标签被读取。但NdefListener不会被解雇。有谁知道如何获得标签信息时,应用程序是由一个意图开始了吗?

I use the phonegap-nfc plugin from chariotsolutions. Reading a NFC tag while the app is running is no problem. I registered the app for intents so it starts when the app is in background and a tag is read. But the NdefListener is not fired. Does anybody know how to get the tag information when the app is started by an intent?

推荐答案

您需要添加一个哑剧监听事件的类型以获得nfcEvent的意图解雇应用程序启动时。

You need to add a mime type listener to get the nfcEvent fired by the intent when the application launches.

您可以使用您所使用的NDEF监听相同的事件处理程序,一切都只是事件类型相同。你并不需要指定一个MIME类型。

You can use the same event handler you are using for the NDEF listener, everything is the same except for the event type. You don't need to specify a mime type.

nfc.addMimeTypeListener(,app.onNfc,成功,失败);

这是一个有点古怪,但它的工作方式,因为事件是如何在插件实现解雇了。

This is a bit odd, but the way it works because of how events are fired in the plugin implementation.

这篇关于chariotsolutions的PhoneGap的NFC插件意图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆