Android的NFC<科技的列表> - 问题 [英] Android NFC <tech-list> - problem

查看:184
本文介绍了Android的NFC<科技的列表> - 问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ID想要写在Android上我的第一个NFC功能的应用程序。对于这个我用的是Android开发者链接: http://developer.android.com/指南/主题/ NFC / index.html的

id want to write my first NFC-application on android. For this i use the android developers link: http://developer.android.com/guide/topics/nfc/index.html

下面用于指定支持的技术,你必须创建这样一个XML文件:

Here for specifying the supported technologies you have to create a xml file like this:

<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    <tech-list>
        <tech>android.nfc.tech.IsoDep</tech>
        <tech>android.nfc.tech.NfcA</tech>
        <tech>android.nfc.tech.NfcB</tech>
        <tech>android.nfc.tech.NfcF</tech>
        <tech>android.nfc.tech.NfcV</tech>
        <tech>android.nfc.tech.Ndef</tech>
        <tech>android.nfc.tech.NdefFormatable</tech>
        <tech>android.nfc.tech.MifareClassic</tech>
        <tech>android.nfc.tech.MifareUltralight</tech>
    </tech-list>
</resources>

我的问题是,在标签我得到以下错误:错误:发现标签技术含量的列表,项目预计

My problem is, at the tag i get following error: "error: Found tag tech-list where item is expected"

我的应用程序的目标是2.3.3。我觉得这对这个目标努力...

The target of my application is 2.3.3. I think this has to work on this target ...

任何想法?

谢谢!

推荐答案

片段从接收NFC意图的活动我的应用程序的Andr​​oidManifest.xml文件

Snippet from my app's AndroidManifest.xml file for the activity that receives NFC intents

<activity
        android:name=".activity.ClientActivity"
        android:screenOrientation="portrait"
        android:label="@string/app_name"
        android:description="@string/app_name"
        android:icon="@drawable/ttlogo">
        <intent-filter>
            <action
                android:name="android.nfc.action.TECH_DISCOVERED"/>
        </intent-filter>
        <meta-data
            android:resource="@xml/nfc_tech_filter"
            android:name="android.nfc.action.TECH_DISCOVERED" />
        <intent-filter>
            <action
                android:name="android.nfc.action.TAG_DISCOVERED" />
            <category
                android:name="android.intent.category.DEFAULT" />
        </intent-filter>
        <intent-filter>
            <action
                android:name="android.intent.action.VIEW" />
            <category
                android:name="android.intent.category.DEFAULT" />
            <data
                android:scheme="http"
                android:host="www.ttag.be" />
        </intent-filter>
    </activity>

包含过滤器定义的文件是RES / XML / nfc_tech_filter.xml,看起来像这样

The file containing the filter definition is in res/xml/nfc_tech_filter.xml and looks like this

<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!--  Touchatag tag -->
<tech-list>
    <tech>android.nfc.tech.NfcA</tech>        
    <tech>android.nfc.tech.Ndef</tech>
    <tech>android.nfc.tech.MifareUltralight</tech>
</tech-list>
<!--  DESFire tag -->
<tech-list>
    <tech>android.nfc.tech.NfcA</tech>        
    <tech>android.nfc.tech.IsoDep</tech>
    <tech>android.nfc.tech.NdefFormatable</tech>
</tech-list>
<!--  Any Tag -->
<tech-list>
    <tech>android.nfc.tech.NfcA</tech>        
</tech-list>

这篇关于Android的NFC&LT;科技的列表&gt; - 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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