-
Notifications
You must be signed in to change notification settings - Fork 39
Open
Description
Please add callback when BLEService was inited, thanks. Sorry, but I use fragment and main activity is owner BLE Service, so I needed callback on service connection at fragment
private final ServiceConnection serviceConnectionListener = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName componentName, IBinder service) {
LogManager.LogEA("Service connected");
mBluetoothLeService = ((BluetoothLeService.LocalBinder) service).getService();
if (!mBluetoothLeService.initialize()) {
LogManager.LogEA(getString(R.string.unable_to_initialize_bluetooth));
MainActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this).setMessage(getString(R.string.unable_to_initialize_bluetooth)).setCancelable(false);
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
MainActivity.this.finish();
}
});
builder.create().show();
}
});
}else{
bluetoothListener.onBluetoothServiceConnected();
LogManager.LogEA(bluetoothListener.getBluetoothListenerId());
}
@Override
public void onServiceDisconnected(ComponentName componentName) {
mBluetoothLeService = null;
LogManager.LogEA("Service disconnected");
}
};Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels