예제 #1
0
  /** {@inheritDoc} */
  @Override
  protected void onStop() {
    super.onStop();

    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    FlurryAgent.onEndSession(this);
  }
예제 #2
0
  /** {@inheritDoc} */
  @Override
  protected void onStart() {
    super.onStart();

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    FlurryAgent.onStartSession(this, "TFBJJPQUQX3S1Q6IUHA6");
  }
예제 #3
0
 public void onPause() {
   if (sensors != null) {
     sensors.unregisterListener(this);
   }
   super.onPause();
   getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
 }
예제 #4
0
 protected void onResume() {
   // Ideally a game should implement onResume() and onPause()
   // to take appropriate action when the activity looses focus
   super.onResume();
   getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
   Sensor gsensor = sensors.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
   Sensor msensor = sensors.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);
   sensors.registerListener(this, gsensor, SensorManager.SENSOR_DELAY_GAME);
   sensors.registerListener(this, msensor, SensorManager.SENSOR_DELAY_GAME);
 }
예제 #5
0
 @Override
 protected void onDestroy() {
   super.onDestroy();
   sec = 0;
   min = 0;
   hour = 0;
   check = 1;
   handler.removeCallbacks(task);
   getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
   //        Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT,
   // defTimeOut);
 }
예제 #6
0
  /** {@inheritDoc} */
  @Override
  public void onCreate(final Bundle icicle) {
    super.onCreate(icicle);
    // Keep screen on during collecting data
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    setContentView(R.layout.recording);
    // add stop button on the screen
    ((Button) findViewById(R.id.stop)).setOnClickListener(this);
    ;

    sensors = (SensorManager) getSystemService(Context.SENSOR_SERVICE);

    handler.removeCallbacks(task);
    handler.postDelayed(task, 500);
  }