Try to use the real Bluetooth address on Android 6. #225

This commit is contained in:
akwizgran
2016-02-23 11:53:54 +00:00
parent 6b802c2ea0
commit 9789c0ff52
3 changed files with 38 additions and 8 deletions

View File

@@ -9,6 +9,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import org.briarproject.android.util.AndroidUtils;
import org.briarproject.api.TransportId;
import org.briarproject.api.android.AndroidExecutor;
import org.briarproject.api.contact.ContactId;
@@ -152,11 +153,13 @@ class DroidtoothPlugin implements DuplexPlugin {
ioExecutor.execute(new Runnable() {
public void run() {
if (!isRunning()) return;
String address = AndroidUtils.getBluetoothAddress(appContext,
adapter);
if (LOG.isLoggable(INFO))
LOG.info("Local address " + adapter.getAddress());
LOG.info("Local address " + address);
// Advertise the Bluetooth address to contacts
TransportProperties p = new TransportProperties();
p.put("address", adapter.getAddress());
p.put("address", address);
callback.mergeLocalProperties(p);
// Bind a server socket to accept connections from contacts
BluetoothServerSocket ss;