在发现的NFC标签上多次启动Android应用程序

时间:2017-01-26 09:35:45

标签: android fragment nfc

在发现的NFC标签上多次启动Android应用程序。我尝试使用此链接Android launch activity multiple times on an NFC tag中的答案。但它说未找到资源。 我正在从片段中读取标签。任何帮助。 这是我的清单

 {{ Form::select('matches_id', Team::find($match2)->team_a_id." vs. ".Team::find($match2)->team_b_id, null, ['class' => 'form-control']) }}

这是我的片段onResume()

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.atsl.touch">
    <uses-permission android:name="android.permission.NFC" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    <uses-feature android:name="android.hardware.nfc" android:required="true"/>
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:launchMode= "singleInstance"
        android:theme="@style/AppTheme">
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.nfc.action.TAG_DISCOVERED"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
        </activity>
    </application>

</manifest>

问题是,当我运行应用程序并在手机应用程序附近持有nfc标签时,启动应用程序的新实例。它没有在初始实例中检测到标记。

0 个答案:

没有答案
相关问题