|
Project Information
Featured
Downloads
Links
|
This package is the backport of android.bluetooth API, introduced in Android 2.0(or higher) to older Android platforms. IMPORTANT new version(ver.2) developing on trunk/backport-android-bluetooth201 Android 2.0 Bluetooth APISee android.bluetooth | Android Developers http://developer.android.com/reference/android/bluetooth/package-summary.html RequirementsAndroid 1.5 Package NamesSince user libraries cannot define classes in android. packages, all the original package names have been prefixed with backport. For instance, android.bluetooth.Hoge becomes backport.android.bluetooth.Hoge. Install1. download backport-android-bluetooth2.jar, and put into your projects's reference libraries. 2. put backport_android_bluetooth.properties in to your src directory. 3. add following line to your AndroidManifest.xml. backport_android_bluetooth.properties#permission_name = ${your package name).PERMISSION_BLUETOOTH
permission_name = com.example.bluetooth.PERMISSION_BLUETOOTH
#request_enable = ${your package name}.action.REQUEST_ENABLE
request_enable = com.example.bluetooth.action.REQUEST_ENABLE
#request_discoverable = ${your package name}.action.REQUEST_DISCOVERABLE
request_discoverable = com.example.bluetooth.action.REQUEST_DISCOVERABLE
AndroidManifest.xml<application...>
<activity android:name="backport.android.bluetooth.RequestEnableActivity"
android:label="Bluetooth Permission Request" android:noHistory="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:configChanges="orientation|keyboardHidden">
<intent-filter>
<!-- ${your package name}.action.REQUEST_ENABLE -->
<action android:name="com.example.bluetooth.action.REQUEST_ENABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name="backport.android.bluetooth.RequestDiscoverableActivity"
android:label="Bluetooth Permission Request" android:noHistory="true"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:configChanges="orientation|keyboardHidden">
<intent-filter>
<!-- ${your package name}.action.REQUEST_DISCOVERABLE -->
<action android:name="com.example.bluetooth.action.REQUEST_DISCOVERABLE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<receiver android:name="backport.android.bluetooth.BluetoothIntentRedirector">
<intent-filter>
<action android:name="android.bluetooth.intent.action.DISCOVERY_COMPLETED" />
<action android:name="android.bluetooth.intent.action.DISCOVERY_STARTED" />
<action android:name="android.bluetooth.intent.action.NAME_CHANGED" />
<action android:name="android.bluetooth.intent.action.SCAN_MODE_CHANGED" />
<action android:name="android.bluetooth.intent.action.BLUETOOTH_STATE_CHANGED" />
<action android:name="android.bluetooth.intent.action.REMOTE_DEVICE_CONNECTED" />
<action android:name="android.bluetooth.intent.action.REMOTE_DEVICE_DISCONNECTED" />
<action android:name="android.bluetooth.intent.action.REMOTE_DEVICE_DISCONNECT_REQUESTED" />
<action android:name="android.bluetooth.intent.action.BOND_STATE_CHANGED" />
<action android:name="android.bluetooth.intent.action.PAIRING_REQUEST" />
<action android:name="android.bluetooth.intent.action.PAIRING_CANCEL" />
<action android:name="android.bluetooth.intent.action.REMOTE_DEVICE_CLASS_UPDATED" />
<action android:name="android.bluetooth.intent.action.REMOTE_DEVICE_FOUND" />
<action android:name="android.bluetooth.intent.action.REMOTE_NAME_UPDATED" />
</intent-filter>
</receiver>
</application>
<uses-permission android:name="android.permission.BLUETOOTH"></uses-permission>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"></uses-permission>
<!-- ${your package name}.PERMISSION -->
<uses-permission android:name="com.example.bluetooth.PERMISSION"></uses-permission>
Getting StartedBluetoothAdapter bluetooth = BluetoothAdapter.getDefaultAdapter(); Build instructionsIf you would like to build your own backport-android-bluetooth2.jar. Select the build.xml, "run as ant" to run from Eclipse. Then, in the root directory of the project will backport-android-bluetooth2.jar has been made Limitations
Historyver.2.2.2fix issue #10 ver.2.2.1implements BluetoothClass. ver.2.2supported for Droid Eris. ver.2.1.2fix bug throw NPE when backport_android_bluetooth.properties is not exists. ver.2.1.1fix bug when open enable/discoverable dialog on 1.5(cupcake) ver.2.1now supported android1.5(cupcake) ver.2trunk/backport-android-bluetooth201 fix many bugs. |