@Override public void onServiceConnected(ComponentName name, IBinder service) { mAccessoryService = ((AccessoryService.MyBinder) service).getService(); mAccessoryService.registerAction(getAction()); isBound = true; Toast.makeText(getApplicationContext(), "onSERVICECONNECTED", Toast.LENGTH_SHORT).show(); }
/** * AccessoryService으로 알람시간간격 전달 * * @param mData */ private void sendDataToService(String mData) { if (isBound && mAccessoryService != null) { mAccessoryService.sendData(mData); } else { Toast.makeText(getApplicationContext(), "기어와 연결을 확인하세요", Toast.LENGTH_SHORT).show(); } }
private void startConnection() { if (isBound && mAccessoryService != null) { mAccessoryService.findPeers(); } }