コード例 #1
0
  @Override
  public void onCreate() {
    super.onCreate();

    binder = binderBuilder.build(this);

    sensorManager = (SensorManager) getApplication().getSystemService(SENSOR_SERVICE);
    accelorometerSensor = sensorManager.getDefaultSensor(SensorManager.SENSOR_ACCELEROMETER);

    sensorChangeMonitor.setSensorChangeListener(this);
  }
コード例 #2
0
  @Override
  public void onDestroy() {
    binder = null;
    binderBuilder = null;
    sensorManager = null;
    accelorometerSensor = null;
    sensorChangeMonitor = null;

    stopAlarmService();

    super.onDestroy();
  }
コード例 #3
0
 @Override
 public int onStartCommand(Intent intent, int flags, int startId) {
   super.onStartCommand(intent, flags, startId);
   if (db == null) {
     android.os.Process.setThreadPriority(Process.THREAD_PRIORITY_FOREGROUND);
     dbHelper = new DatabaseHelper(getApplicationContext());
     db = dbHelper.getWritableDatabase();
     dataHelper = DataHelper.getInstance(getApplicationContext());
     appChangeReceiver = new ApplicationChangeReceiver();
     screenStateReceiver = new ScreenStateReceiver();
     remoteLoggingReceiver = new RemoteLoggingReceiver();
     registerReceiver(screenStateReceiver, screenStateReceiver.buildIntentFilter());
     startRemoteLogging();
     startTimeCount();
   }
   return START_STICKY;
 }
コード例 #4
0
 @Override
 public void onTaskRemoved(Intent rootIntent) {
   restartService();
   super.onTaskRemoved(rootIntent);
 }
コード例 #5
0
 @Override
 public void onDestroy() {
   super.onDestroy();
   mAnalytics.stop();
 }
コード例 #6
0
 @Override
 public void onStart(Intent intent, int startId) {
   super.onStart(intent, startId);
   mAnalytics.start();
 }