0

Why this code is device specific?

ContentValues values = new ContentValues();
values.put(BluetoothShare.URI, Uri.fromFile(new File(uri.getPath())).toString());

//values.put(BluetoothShare.URI, uri.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);
final Uri contentUri =  getApplicationContext().getContentResolver().
                               insert(BluetoothShare.CONTENT_URI, values);
Naveed
  • 1,979
  • 1
  • 13
  • 20
  • clarify by what you mean *device specific*? Are you referring to the usage of `values.put(BluetoothShare.DESTINATION,device.getAddress());` i.e. `device.getAddress()`? If so, the devices have to paired first and the address of the remote receiving device has to be known first beforehand. – t0mm13b Apr 02 '13 at 19:45
  • @t0mm13b This code is working fine on HTC Amaze os2.3.4 but not on Galaxy tab P1000 os 2.2 – Naveed Apr 02 '13 at 19:47
  • Maybe the Tab P1000 does not have the `BluetoothShare` content provider! – t0mm13b Apr 02 '13 at 19:49
  • @t0mm13b Check this : http://stackoverflow.com/questions/5577481/sending-a-file-using-bluetooth-obex-object-push-profile-opp – Naveed Apr 02 '13 at 19:50
  • And your point being? Some devices have them, others don't... Manufacturers are free to change things internally :) Also, that code is undocumented, and not reliable, i.e. no public API to enable transmitting files via bluetooth share i.e. OBEX. – t0mm13b Apr 02 '13 at 19:53
  • In short if you need to have it the Android would have to be patched - [see this](http://i-miss-erin.blogspot.in/2009/10/how-to-have-obex-function-in-android.html) and rebuilt from scratch :) – t0mm13b Apr 02 '13 at 19:55
  • And also, don't forget - the limitation could also well be the bluetooth driver stack as well... *never use undocumented code* as it will cause grief and headaches. If you want to transfer a file, best to implement a BT protocol yourself and use sockets. Sorry! – t0mm13b Apr 02 '13 at 19:59
  • @t0mm13b any other way :) – Naveed Apr 02 '13 at 19:59

0 Answers0