getBluetoothService called with no BluetoothManagerCallback

By reading into the Android source code, it seems to be a warning you cannot do anything about. The source code shows that if you call BluetoothSocket#connect(); Then it will call BluetoothAdapter.getDefaultAdapter().getBluetoothService(null); The key here, is the null parameter that it passes in the above line. Due to this, there will be no callback, and … Read more

Android Bluetooth Example [closed]

I have also used following link as others have suggested you for bluetooth communication. http://developer.android.com/guide/topics/connectivity/bluetooth.html The thing is all you need is a class BluetoothChatService.java this class has following threads: Accept Connecting Connected Now when you call start function of the BluetoothChatService like: mChatService.start(); It starts accept thread which means it will start looking for … Read more

Can an Android device act as an iBeacon?

YES This is possible on Android 5+, and you can find open-source code for transmitting as a beacon in the Android Beacon Library. There is also a full-featured version of a beacon transmitter in the Beacon Scope app in the Google Play Store. Here’s an example of transmitting iBeacon with the Android Beacon Library: Beacon … Read more

Find all Bluetooth devices (headsets, phones etc) nearby, without forcing the devices in discoverable mode

So, here’s all I found after reading blogs, threads, documentations, SO answers etc. regarding Android’s bluetooth discovery. Thought this might be useful to post my findings here. So before someone starts reading, I want to clarify that, I could not find any way to detect a bluetooth device nearby which is turned on but not … Read more

How to unpair bluetooth device using android 2.1 sdk

Here’s how you unpair/remove a bonded device call this method where macAddress is the string of the mac address of the device..i.e. “00:02:00:A3:03:05” IBluetooth ib =getIBluetooth(); ib.removeBond(macAddress); To get the IBluetooth Object you need to go through a couple of steps create a package in your project called android.bluetooth create two files, IBluetooth.aidl and IBluetoothCallback.aidl … Read more

Bluetooth Connection failed “java.io.IOException: read failed, socket might closed or timeout, read ret: -1”

In the constructor of BluetoothConnector.java, a list of uuidCandidates is passed. public BluetoothConnector(BluetoothDevice device, boolean secure, BluetoothAdapter adapter, List<UUID> uuidCandidates) { this.device = device; this.secure = secure; this.adapter = adapter; this.uuidCandidates = uuidCandidates; if (this.uuidCandidates == null || this.uuidCandidates.isEmpty()) { this.uuidCandidates = new ArrayList<UUID>(); this.uuidCandidates.add(UUID.fromString(“fa87c0d0-afac-11de-8a39-0800200c9a66”)); } } Have you passed it null? If yes,then try … Read more

How to send file from Android device to other device through Bluetooth by code

Here is the code from which you can send file via bluetooth from android device to any device. btnOk.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { txtContent = (EditText)findViewById(R.id.txtContent); imageView = (ImageView)findViewById(R.id.imageView); linearLayout = (LinearLayout)findViewById(R.id.linearLayout); viewToBeConverted = (TextView) findViewById(R.id.hello); linearLayout.setDrawingCacheEnabled(true); //Toast.makeText(MainActivity.this, file.toString(), Toast.LENGTH_LONG).show(); try { if(file.exists()) { file.delete(); } out = new FileOutputStream(file); } … Read more