0

sorry for my bad english, can someone tha has worked with java on a mobile device (cell phone) tell me if its possible to enable the bluetooth connection of the device from a java application?

thanks

Buhake Sindi
  • 87,898
  • 29
  • 167
  • 228
Rick
  • 1
  • 1
  • you mean you want to enable or disable the bluetooth radio? – theomega Jul 28 '10 at 22:09
  • you cannot turn on bluetooth using java.but you can use the turned ON bluetooth in J2ME – jmj Jul 29 '10 at 10:45
  • Yes, I wanted to enable the bluetooth radio from my application... I guess I will have to instruct the users how to do it then :( thanks for the help guys. – Rick Jul 29 '10 at 12:31
  • @org.life.java, you can connect to bluetooth in java. If BT is turned off, then it will ask permission to turn it on (just like trying to connect to the internet). – Buhake Sindi Jul 29 '10 at 13:35
  • @The Elite Gentleman are you sure? have you tried it? i tried it long time before at that time i informed user to turn it on manually. can you reconfirm ? – jmj Jul 29 '10 at 15:28
  • @org.life.java, I haven't used J2ME with MIDP of CLDC 2.0 (so basically MIDP 1). I clearly remember that whenever you tried activating bluetooth that's off, there's a popup to confirm whether you want an application to use the bluetooth device. I may be wrong in the new version. – Buhake Sindi Jul 29 '10 at 16:18
  • Duplicate of http://stackoverflow.com/questions/2433925/how-to-turn-bluetooth-on-off-with-j2me – Deependra Solanky Jul 30 '10 at 17:40
  • @JigarJoshi.. Yes, It is available in j2me (or java) that If BT is turned off, then it will ask permission to turn it on. For that You have to give permissions to your application from Properties. – Riddhi Barbhaya Nov 15 '13 at 12:38

2 Answers2

0

Yes, it's absolutely possible with J2ME (Java 2 Micro Edition). I did this 3 years back so I have little knowledge.

  1. Go to Oracle's Website and download the J2ME libraries/packages from Oracle.
  2. Follow example here and here for tutorial how to connect to bluetooth device.
Buhake Sindi
  • 87,898
  • 29
  • 167
  • 228
0
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
//for enable blutooth(Turn on)
Intent eintent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(eintent, 1);
//for disable(Turn of)
bluetoothAdapter.disable();
Nikos Hidalgo
  • 3,666
  • 9
  • 25
  • 39