Since Android 4.1 it is no more allowed to communicate directly with the Bluetooth Service, as in the following code:
ContentValues values = new ContentValues(); > String path = Environment.getExternalStorageDirectory().toString();File > imageFile = new File(path, "CurrentLumenboxPrint.jpg"); > //build the message to send on BT > values.put(BluetoothShare.URI, Uri.fromFile(imageFile).toString()); > values.put(BluetoothShare.MIMETYPE, "image/jpeg"); > values.put(BluetoothShare.DESTINATION, device.getAddress()); > values.put(BluetoothShare.DIRECTION, BluetoothShare.DIRECTION_OUTBOUND);Long > ts = System.currentTimeMillis(); > values.put(BluetoothShare.TIMESTAMP, ts); > // Here is where the exception happens final Uri contentUri = > getApplicationContext().getContentResolver().insert(BluetoothShare.CONTENT_URI, > values); > > I found a piece of workaround at this link<http://stackoverflow.com/questions/12388503/android-bluetooth-print-stopped-working-on-4-1/13359086#13359086>, but this workaround don't provide the same behavior. I need to automatically launch the transfer and this workaround opens the "device picker" windows in order to let the user choose the destination device. The author of this workaround give extra info to fully automate the process (catching the intent android.bluetooth.devicepicker.action.LAUNCH and sending another android.bluetooth.devicepicker.action.DEVICE_SELECTED), but I don't manage to do that. Does someone has another solution to automatically send file using Bluetooth OPP on JellyBean ? Many thanks for your answers. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

