// LIFE CYCLE BEGIN public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); hideFragment(R.id.online_screen); hideFragment(R.id.sleep_screen); hideFragment(R.id.master_password_screen); hideFragment(R.id.configure_screen); PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE); wakeLock = pm.newWakeLock( PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE, "INFO"); wakeLock.acquire(); audioManager = (AudioManager) this.getSystemService(Context.AUDIO_SERVICE); remoteControlResponder = new ComponentName(getPackageName(), RemoteControlReceiver.class.getName()); securityController = new SecurityController(this); MyFirebaseInstanceIDService.setMainActivity(this); MyFirebaseMessagingService.setMainActivity(this); }
protected void onDestroy() { MyFirebaseInstanceIDService.setMainActivity(null); MyFirebaseMessagingService.setMainActivity(null); wakeLock.release(); super.onDestroy(); }