/** {@inheritDoc} */ @Override protected void onStop() { super.onStop(); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); FlurryAgent.onEndSession(this); }
/** {@inheritDoc} */ @Override protected void onStart() { super.onStart(); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); FlurryAgent.onStartSession(this, "TFBJJPQUQX3S1Q6IUHA6"); }
public void onPause() { if (sensors != null) { sensors.unregisterListener(this); } super.onPause(); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); }
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); }
@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); }
/** {@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); }