android连接方式

Android 连接方式:

设备之间的连接通过=> Bluetooth-蓝牙, NFC, WI-FI, P2P, USB, SIP

监控网络连接

基本权限:

1
2
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

NFC连接

  • 权限: AndroidManifest.xml
1
<uses-permission android:name="android.permission.NFC" />
  • 配置最小sdk: 现在已经不需要了
1
<uses-sdk android:minSdkVersion="10"/>
  • 是否需要在具有NFC功能的手机显示在GooglePlay上
1
<uses-feature android:name="android.hardware.nfc" android:required="true" />

intent filter 行为

  • ACTION_NDEF_DISCOVERED
1
2
3
4
5
6
7
8
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain" />
<data android:scheme="http"
android:host="developer.android.com"
android:pathPrefix="/index.html" />
</intent-filter>
  • ACTION_TECH_DISCOVERED
  • ACTION_TAG_DISCOVERED
1
2
3
<intent-filter>
<action android:name="android.nfc.action.TAG_DISCOVERED"/>
</intent-filter>