意向过滤器不适用于Android Beam NFC

意向过滤器不适用于Android Beam NFC,android,nfc,intentfilter,nfc-p2p,android-beam,Android,Nfc,Intentfilter,Nfc P2p,Android Beam,我相信这很简单,但我无法理解。我所要做的就是通过NFC android Beam发送一条消息,然后在接收设备上打开我的应用程序。我确实在一个新项目上测试了我的代码,它工作得很好,但如果我在我的真实项目上尝试,它只会开始收集新的标记,并显示application/eu.freemoser.mydebts2go-see。我不知道怎么了也许是舱单有问题?谷歌搜索结果与我的问题不符,或者我太笨了,但我相信我发现了一些问题,不幸的是我仍然无法解决我的问题 我的舱单: <?xml version="1

我相信这很简单,但我无法理解。我所要做的就是通过NFC android Beam发送一条消息,然后在接收设备上打开我的应用程序。我确实在一个新项目上测试了我的代码,它工作得很好,但如果我在我的真实项目上尝试,它只会开始收集新的标记,并显示application/eu.freemoser.mydebts2go-see。我不知道怎么了也许是舱单有问题?谷歌搜索结果与我的问题不符,或者我太笨了,但我相信我发现了一些问题,不幸的是我仍然无法解决我的问题

我的舱单:

<?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="eu.freemoser.myDebts2go"
        android:versionCode="16"

        android:versionName="1.1.0">

        <uses-permission android:name="android.permission.GET_ACCOUNTS" />
        <uses-permission android:name="android.permission.READ_CONTACTS" />
        <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="android.permission.NFC" />
        <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
        <uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" />
        <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
        <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
        <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
        <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
        <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
        <uses-permission android:name="com.android.alarm.permission.SET_ALARM" />

        <uses-feature android:name="android.hardware.nfc" android:required="false" />
        <uses-feature android:name="android.hardware.camera" />



        <uses-sdk
            android:minSdkVersion="16"
            android:targetSdkVersion="19" />
        <uses-feature
            android:glEsVersion="0x00020000"
            android:required="true" />

        <application
            android:name="eu.freemoser.myDebts2go.MyApplication"
            android:allowBackup="true"
            android:hardwareAccelerated="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            android:theme="@style/Theme.Mydebts2go">
            >


            <service android:name="eu.freemoser.myDebts2goService.NotificationService"></service>
            <service android:name="eu.freemoser.myDebts2goService.SynchronizationService"></service>
            <service android:name="eu.freemoser.myDebts2goService.SynchronizService"></service>
            <service android:name="eu.freemoser.myDebts2goService.AwesomeSynchronizService"></service>


            <activity
                android:name="eu.freemoser.myDebts2go.MainActivity"
                android:label="@string/app_name"
                android:screenOrientation="portrait">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>


            <activity
           android:name="eu.freemoser.myDebts2GoActivities.AwesomeDetailActivity"
                android:screenOrientation="portrait" android:theme="@style/Theme.MyDebts2GO.Detail">
            </activity>

            <activity android:name=".AndroidBeamActivity" android:screenOrientation="portrait"
                android:theme="@android:style/Theme.DeviceDefault.Wallpaper.NoTitleBar">
                <intent-filter>
                    <action android:name="android.nfc.action.NDEF_DISCOVERED" />
                    <category android:name="android.intent.category.DEFAULT" />
                    <data android:mimeType="application/eu.freemoser.myDebts2go" />
                </intent-filter>
            </activity>

            <activity android:name="eu.freemoser.myDebts2GoActivities.DriveRestoreActivity"></activity>
            <activity android:name="eu.freemoser.myDebts2GoActivities.SynchronizActivity"></activity>

            <activity android:name="eu.freemoser.myDebts2GoActivities.SettingActivity">
                <intent-filter>
                    <action android:name="android.intent.action.MANAGE_NETWORK_USAGE" />
                    <category android:name="android.intent.category.DEFAULT" />
                </intent-filter>
            </activity>

            <activity android:name="eu.freemoser.myDebts2GoActivities.DatePickerActivity"></activity>
            <activity android:name="eu.freemoser.myDebts2GoActivities.LocationPickerActivity"></activity>

            <activity android:name="eu.freemoser.myDebts2GoActivities.SearchActivity">
                <intent-filter>
                    <action android:name="android.intent.action.SEARCH" />
                </intent-filter>
            </activity>

            <activity
                android:name="eu.freemoser.myDebts2GoActivities.DriveAuthorzingActivity"
                android:theme="@android:style/Theme.Translucent.NoTitleBar">
            </activity>

            <activity
                android:name="eu.freemoser.myDebts2GoActivities.FastModusShortcutActivity"
                android:exported="true"
                android:theme="@android:style/Theme.Holo.Light.NoActionBar">
            </activity>


            <!-- android:value="API_KEY" /> DEBUG-->

            <meta-data
                android:name="com.google.android.maps.v2.API_KEY"
                android:value="API_KEY" />
            <meta-data
                android:name="com.google.android.gms.version"
                android:value="VERSION" />


        </application>


    </manifest>

Android的意图过滤器MIME类型匹配区分大小写,尽管MIME类型本身不区分大小写。因此,对于Android,以及几乎所有使用它们的地方,您都应该遵守只使用小写字母的MIME类型的惯例

特别是对于通过NFC接收的MIME类型记录,Android将自动将其转换为所有小写字母,以克服意图过滤器中的大小写敏感问题。因此,在您的示例中,将意图过滤器中的类型名称更改为application/eu.freemoser.mydebts2go应该可以:

<intent-filter>
    <action android:name="android.nfc.action.NDEF_DISCOVERED"/>
    <category android:name="android.intent.category.DEFAULT"/>
    <data android:mimeType="application/eu.freemoser.mydebts2go"/>
</intent-filter>
public class Beam extends Activity {
    private Long userID = null;
    private Long adressID = null;

    private DBAdapter myDb;
    //NFC
    private String myBetrag;
    private String myTitle;
    private String myContactName;
    private String myDebtDate;
    private String myCreateDate;
    private String myStatus;
    private String myRemamberDate;
    private String myNote;

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);


    }

    @Override
    protected void onResume() {
        super.onResume();
        if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(getIntent().getAction())) {
            processIntent(getIntent());
        }
    }

    void processIntent(Intent intent) {
        myDb = new DBAdapter(this);
        myDb.open();
        Parcelable[] rawMsgs = intent.getParcelableArrayExtra(
                NfcAdapter.EXTRA_NDEF_MESSAGES);
        // only one message sent during the beam
        NdefMessage msg = (NdefMessage) rawMsgs[0];
        // record 0 contains the MIME type, record 1 is the AAR, if present
        String temp = new String(msg.getRecords()[0].getPayload());
        String[] arrrayTemp = temp.split("//");
        try {
            myBetrag = arrrayTemp[0];
            myTitle = arrrayTemp[1];
            myContactName = arrrayTemp[2];
            myStatus = arrrayTemp[3];
            myDebtDate = arrrayTemp[4];
            myCreateDate = arrrayTemp[5];
            // can be "NOT"
            myRemamberDate = arrrayTemp[6];
            myNote = arrrayTemp[7];
            // checkValues
            channgeStatus();
            checkIfNot();
            checkUser();
            //write to database
            write();

        } catch (Exception ex) {
            this.finish();
        }


    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        myDb.close();
    }

    private void checkUser() {
        //do some stuff
       ...
    }

    private void write() {

    //do some stuff
       ...

    }

    private void checkIfNot() {
    //do some stuff
       ...
    }

    private void channgeStatus() {
    //do some stuff
       ...
    }

    @Override
    public void onNewIntent(Intent intent) {
        // onResume gets called after this to handle the intent
        setIntent(intent);
    }

}
<intent-filter>
    <action android:name="android.nfc.action.NDEF_DISCOVERED"/>
    <category android:name="android.intent.category.DEFAULT"/>
    <data android:mimeType="application/eu.freemoser.mydebts2go"/>
</intent-filter>
NdefMessage msg = new NdefMessage(
            new NdefRecord[]{createMimeRecord(
                    "application/eu.freemoser.mydebts2go", text.getBytes())});