Example #1
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();
 }
Example #2
0
  @Override
  public int onStartCommand(Intent intent, int flags, int startId) {
    log.putLog("CS Starting...");
    if (isRunning()) {
      log.putLog("Already running");
      stopSelf();
      return START_NOT_STICKY;
    }
    setRunning(true);
    // startDebugThread();

    videoService = new VideoService(this);
    usbService = new UsbService(this);
    lightService = new LightService(this);
    orientationService = new OrientationService(this);
    locationService = new LocationService(this);
    updateService = new UpdateService(this);
    bindService(networkServiceIntent, networkServiceConnection, Context.BIND_AUTO_CREATE);

    usbService.start();
    updateService.start();

    return super.onStartCommand(intent, flags, startId);
  }
Example #3
0
 public void restartUsbService() {
   if (usbService != null) {
     usbService.stop();
     usbService.start();
   }
 }