Skip to content

Commit

Permalink
Enhancement #4: EmergencyModeService update.
Browse files Browse the repository at this point in the history
EmergencyModeService.setEmergencyModeState(), EmergencyModeService.resetEmergencyModeState() methods added to set shared preference value when service is started and reset when destroyed.
  • Loading branch information
ferdouszislam committed May 6, 2021
1 parent e105de0 commit af6b6ef
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ public int onStartCommand(Intent intent, int flags, int startId) {
NotificationManagerCompat.from(this).notify(FOREGROUND_NOTIFICATION_ID, getForegroundNotification());
}

setEmergencyModeState();

init();

return START_STICKY;
Expand All @@ -85,10 +87,19 @@ private void init() {
public void onDestroy() {
super.onDestroy();

resetEmergencyModeState(); // laav hoy nai kore

removeVolumeListener();
removeForegroundNotification();
}

private void setEmergencyModeState() {
AppSettingsSharedPref.build(this).setEmergencyModeState(true);
}
private void resetEmergencyModeState() {
AppSettingsSharedPref.build(this).setEmergencyModeState(false);
}

private void onVolumeUpPress() {

Log.d(TAG, "onVolumeUpPress: volume up");
Expand Down

0 comments on commit af6b6ef

Please sign in to comment.