1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-24 02:46:50 +01:00

Pebble: No pairing activity, just call createBond() and finish discovery activity

This commit is contained in:
Andreas Shimokawa 2015-05-10 16:27:31 +02:00
parent a70426d84d
commit f101926186
2 changed files with 16 additions and 5 deletions

View File

@ -294,8 +294,20 @@ public class DiscoveryActivity extends Activity implements AdapterView.OnItemCli
}
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(deviceCandidate);
Intent intent = new Intent(this, coordinator.getPairingActivity());
intent.putExtra(DeviceCoordinator.EXTRA_DEVICE_MAC_ADDRESS, deviceCandidate.getMacAddress());
startActivity(intent);
Class<? extends Activity> pairingActivity = coordinator.getPairingActivity();
if (pairingActivity != null) {
Intent intent = new Intent(this, pairingActivity);
intent.putExtra(DeviceCoordinator.EXTRA_DEVICE_MAC_ADDRESS, deviceCandidate.getMacAddress());
startActivity(intent);
}
else {
try {
BluetoothDevice btDevice = adapter.getRemoteDevice(deviceCandidate.getMacAddress());
btDevice.createBond();
finish();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}

View File

@ -2,7 +2,6 @@ package nodomain.freeyourgadget.gadgetbridge.pebble;
import android.app.Activity;
import nodomain.freeyourgadget.gadgetbridge.ControlCenter;
import nodomain.freeyourgadget.gadgetbridge.DeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.GBDevice;
@ -26,6 +25,6 @@ public class PebbleCoordinator implements DeviceCoordinator {
@Override
public Class<? extends Activity> getPairingActivity() {
return ControlCenter.class;
return null;
}
}