Exemple #1
0
 @Override
 public void onServiceConnected(ComponentName name, IBinder service) {
   networkService = ((NetworkBinder) service).getService();
   networkService.addListener(CopService.this);
   networkService.addListener(usbService);
   if (!networkService.isRunning()) {
     startService(networkServiceIntent);
   }
 }
Exemple #2
0
 @Override
 public boolean handleMessage(Message msg) {
   if (msg.obj == null) return false;
   CustomService service = (CustomService) msg.obj;
   if (msg.arg1 == Protocol.Req.off()) {
     service.stop();
     if (networkService != null) {
       networkService.removeListener(service);
     }
   } else if (msg.arg1 == Protocol.Req.on()) {
     service.start();
     networkService.addListener(service);
   }
   return false;
 }
Exemple #3
0
 public synchronized void stop() {
   setRunning(false);
   try {
     unbindService(networkServiceConnection);
     wakeUpCallback.stop();
   } catch (Exception ignored) {
   }
   networkService.stop();
   videoService.stop();
   usbService.stop();
   lightService.stop();
   orientationService.stop();
   locationService.stop();
   updateService.stop();
   stopSelf();
 }