コード例 #1
0
 @Override
 public void onServiceConnected(ComponentName componentName, IBinder service) {
   Log.d(TAG, "onServiceConnected");
   mBluetoothLeService = ((BluetoothLeService.LocalBinder) service).getService();
   if (!mBluetoothLeService.initialize()) {
     Log.e(TAG, "Unable to initialize Bluetooth");
     Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
     startActivityForResult(enableBtIntent, BluetoothLeService.REQUEST_ENABLE_BT);
     Log.d(TAG, "requiring user to turn ON bluetooth");
     return;
   }
   mBluetoothLeService.readAlarms();
 }