Good day. I am writing a program to read and write data via NFC. There are no problems with the work of the program itself, but there is a problem with the launch. If several programs are installed, when contacting an NFC device, the OS offers to choose which one to run, even if mine is running. If you select mine, the running code works correctly. If a third-party program is running, a second request is not offered. The question is how to “tell” the android that you should not ask what to read the label if the program is already running. Manifesto:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="aaa.nfctest"> <uses-sdk android:minSdkVersion="10"/> <uses-permission android:name="android.permission.NFC"/> <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:theme="@style/AppTheme"> <activity android:name=".MainActivity" android:launchMode="standard"> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name=".nfc" android:launchMode="singleTask"> <intent-filter> <action android:name="android.nfc.action.TECH_DISCOVERED"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> <meta-data android:name="android.nfc.action.TECH_DISCOVERED" android:resource="@xml/nfc_tech_filter"/> </activity> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/> </application> In the program (for the present prototype), the label is read when launched in onCreate, if the program is running - in onNewIntent.