¡@

Home 

2014/10/16 ¤W¤È 08:10:38

android Programming Glossary: bluetoothdevice

Using the Android RecognizerIntent with a bluetooth headset

http://stackoverflow.com/questions/14991158/using-the-android-recognizerintent-with-a-bluetooth-headset

android.bluetooth.BluetoothClass import android.bluetooth.BluetoothDevice import android.bluetooth.BluetoothHeadset import android.bluetooth.BluetoothProfile.. private BluetoothHeadset mBluetoothHeadset private BluetoothDevice mConnectedHeadset private AudioManager mAudioManager private.. mBroadcastReceiver new IntentFilter BluetoothDevice.ACTION_ACL_CONNECTED mContext.registerReceiver mBroadcastReceiver..

How to prevent Android bluetooth RFCOMM connection from dying immediately after .connect()?

http://stackoverflow.com/questions/2660968/how-to-prevent-android-bluetooth-rfcomm-connection-from-dying-immediately-after

in public void test throws Exception if connected return BluetoothDevice zee BluetoothAdapter.getDefaultAdapter . getRemoteDevice 00.. private InputStream in public void test throws IOException BluetoothDevice zee BluetoothAdapter.getDefaultAdapter . getRemoteDevice 00.. .registerReceiver receiver new IntentFilter BluetoothDevice.ACTION_ACL_CONNECTED getApplicationContext .registerReceiver..

Disconnect a bluetooth socket in Android

http://stackoverflow.com/questions/3031796/disconnect-a-bluetooth-socket-in-android

additional info it's a Nonin 4100 medical sensor. Set BluetoothDevice pairedDevices Activa.myBluetoothAdapter.getBondedDevices If.. if pairedDevices.size 0 Loop through paired devices for BluetoothDevice device pairedDevices Add the name and address to an array adapter.. Activa.myBluetoothAdapter.cancelDiscovery socket.connect BluetoothDevice hxm BluetoothAdapter.getDefaultAdapter .getRemoteDevice device.getAddress..

Service discovery failed exception using Bluetooth on Android

http://stackoverflow.com/questions/3397071/service-discovery-failed-exception-using-bluetooth-on-android

Get the BLuetoothDevice object BluetoothDevice device m_BluetoothAdapter.getRemoteDevice address Attempt to.. 00001101 0000 1000 8000 00805F9B34FB private void connect BluetoothDevice device m_Device device BluetoothSocket tmp null Get a BluetoothSocket.. null Get a BluetoothSocket for a connection with the given BluetoothDevice try tmp device.createRfcommSocketToServiceRecord MY_UUID catch..

How to programmatically tell if a Bluetooth device is connected? (Android 2.2)

http://stackoverflow.com/questions/4715865/how-to-programmatically-tell-if-a-bluetooth-device-is-connected-android-2-2

void onCreate ... IntentFilter filter1 new IntentFilter BluetoothDevice.ACTION_ACL_CONNECTED IntentFilter filter2 new IntentFilter BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED.. IntentFilter filter2 new IntentFilter BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED IntentFilter filter3 new IntentFilter.. IntentFilter filter3 new IntentFilter BluetoothDevice.ACTION_ACL_DISCONNECTED this.registerReceiver mReceiver filter1..

Sending a File using Bluetooth OBEX Object Push Profile (OPP)

http://stackoverflow.com/questions/5577481/sending-a-file-using-bluetooth-obex-object-push-profile-opp

code sends a file on the SD card to a bluetooth device BluetoothDevice device String filePath Environment.getExternalStorageDirectory..

Bluetooth pairing without user confirmation

http://stackoverflow.com/questions/5885438/bluetooth-pairing-without-user-confirmation

why createInsecureRfcommSocketToServiceRecord was added to BluetoothDevice starting in Android 2.3.3 API Level 10 SDK Docs ...before that..

Bluetooth Printer issue in android

http://stackoverflow.com/questions/7145787/bluetooth-printer-issue-in-android

import android.bluetooth.BluetoothDevice import android.bluetooth.BluetoothSocket import android.content.BroadcastReceiver.. BroadcastReceiver IntentFilter filter new IntentFilter BluetoothDevice.ACTION_FOUND registerReceiver mReceiver filter Don't forget.. try System.out .println # connecting BluetoothDevice mdevice mBTAdapter .getRemoteDevice address Method m mdevice.getClass..

Using the Android RecognizerIntent with a bluetooth headset

http://stackoverflow.com/questions/14991158/using-the-android-recognizerintent-with-a-bluetooth-headset

import android.bluetooth.BluetoothAdapter import android.bluetooth.BluetoothClass import android.bluetooth.BluetoothDevice import android.bluetooth.BluetoothHeadset import android.bluetooth.BluetoothProfile import android.content.BroadcastReceiver.. private Context mContext private BluetoothAdapter mBluetoothAdapter private BluetoothHeadset mBluetoothHeadset private BluetoothDevice mConnectedHeadset private AudioManager mAudioManager private boolean mIsCountDownOn private boolean mIsStarting private.. if mAudioManager.isBluetoothScoAvailableOffCall mContext.registerReceiver mBroadcastReceiver new IntentFilter BluetoothDevice.ACTION_ACL_CONNECTED mContext.registerReceiver mBroadcastReceiver new IntentFilter BluetoothDevice.ACTION_ACL_DISCONNECTED..

How to prevent Android bluetooth RFCOMM connection from dying immediately after .connect()?

http://stackoverflow.com/questions/2660968/how-to-prevent-android-bluetooth-rfcomm-connection-from-dying-immediately-after

false private BluetoothSocket sock private InputStream in public void test throws Exception if connected return BluetoothDevice zee BluetoothAdapter.getDefaultAdapter . getRemoteDevice 00 1C 4D 02 A6 55 Method m zee.getClass .getMethod createRfcommSocket.. e e.printStackTrace private BluetoothSocket sock private InputStream in public void test throws IOException BluetoothDevice zee BluetoothAdapter.getDefaultAdapter . getRemoteDevice 00 1C 4D 02 A6 55 sock zee.createRfcommSocketToServiceRecord .. savedInstanceState setContentView R.layout.main getApplicationContext .registerReceiver receiver new IntentFilter BluetoothDevice.ACTION_ACL_CONNECTED getApplicationContext .registerReceiver receiver new IntentFilter BluetoothDevice.ACTION_ACL_DISCONNECTED..

Disconnect a bluetooth socket in Android

http://stackoverflow.com/questions/3031796/disconnect-a-bluetooth-socket-in-android

this Thanks in advance. EDITED Here is the code if anyone needs additional info it's a Nonin 4100 medical sensor. Set BluetoothDevice pairedDevices Activa.myBluetoothAdapter.getBondedDevices If there are paired devices if pairedDevices.size 0 Loop through.. If there are paired devices if pairedDevices.size 0 Loop through paired devices for BluetoothDevice device pairedDevices Add the name and address to an array adapter to show in a ListView String name device.getName if.. 0000 1000 8000 00805F9B34FB handler.sendEmptyMessage 5 Activa.myBluetoothAdapter.cancelDiscovery socket.connect BluetoothDevice hxm BluetoothAdapter.getDefaultAdapter .getRemoteDevice device.getAddress Method m try m hxm.getClass .getMethod createRfcommSocket..

Service discovery failed exception using Bluetooth on Android

http://stackoverflow.com/questions/3397071/service-discovery-failed-exception-using-bluetooth-on-android

String address data.getExtras .getString DeviceListActivity.EXTRA_DEVICE_ADDRESS Get the BLuetoothDevice object BluetoothDevice device m_BluetoothAdapter.getRemoteDevice address Attempt to connect to the device connect device break case REQUEST_ENABLE_BT.. function private static final UUID MY_UUID UUID.fromString 00001101 0000 1000 8000 00805F9B34FB private void connect BluetoothDevice device m_Device device BluetoothSocket tmp null Get a BluetoothSocket for a connection with the given BluetoothDevice try.. BluetoothDevice device m_Device device BluetoothSocket tmp null Get a BluetoothSocket for a connection with the given BluetoothDevice try tmp device.createRfcommSocketToServiceRecord MY_UUID catch IOException e m_Socket tmp m_BluetoothAdapter.cancelDiscovery..

How to programmatically tell if a Bluetooth device is connected? (Android 2.2)

http://stackoverflow.com/questions/4715865/how-to-programmatically-tell-if-a-bluetooth-device-is-connected-android-2-2

and ACTION_ACL_DISCONNECTED broadcasts public void onCreate ... IntentFilter filter1 new IntentFilter BluetoothDevice.ACTION_ACL_CONNECTED IntentFilter filter2 new IntentFilter BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED IntentFilter.. ... IntentFilter filter1 new IntentFilter BluetoothDevice.ACTION_ACL_CONNECTED IntentFilter filter2 new IntentFilter BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED IntentFilter filter3 new IntentFilter BluetoothDevice.ACTION_ACL_DISCONNECTED this.registerReceiver.. filter2 new IntentFilter BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED IntentFilter filter3 new IntentFilter BluetoothDevice.ACTION_ACL_DISCONNECTED this.registerReceiver mReceiver filter1 this.registerReceiver mReceiver filter2 this.registerReceiver..

Sending a File using Bluetooth OBEX Object Push Profile (OPP)

http://stackoverflow.com/questions/5577481/sending-a-file-using-bluetooth-obex-object-push-profile-opp

Grab the java class BluetoothShare from here Than the following code sends a file on the SD card to a bluetooth device BluetoothDevice device String filePath Environment.getExternalStorageDirectory .toString file.jpg ContentValues values new ContentValues..

Bluetooth pairing without user confirmation

http://stackoverflow.com/questions/5885438/bluetooth-pairing-without-user-confirmation

nfc share improve this question This need is exactly why createInsecureRfcommSocketToServiceRecord was added to BluetoothDevice starting in Android 2.3.3 API Level 10 SDK Docs ...before that there was no SDK support for this. It was designed to allow..

Bluetooth Printer issue in android

http://stackoverflow.com/questions/7145787/bluetooth-printer-issue-in-android

android.app.Activity import android.app.Dialog import android.bluetooth.BluetoothAdapter import android.bluetooth.BluetoothDevice import android.bluetooth.BluetoothSocket import android.content.BroadcastReceiver import android.content.Context import.. startActivityForResult i 0 Register the BroadcastReceiver IntentFilter filter new IntentFilter BluetoothDevice.ACTION_FOUND registerReceiver mReceiver filter Don't forget to unregister during onDestroy dialogProgress.setTitle.. Connecting... dialogProgress.show mBTAdapter.cancelDiscovery try System.out .println # connecting BluetoothDevice mdevice mBTAdapter .getRemoteDevice address Method m mdevice.getClass .getMethod createRfcommSocket new Class int.class..