Files
fksar/docs/thijooree/27-settings-notifications.md
T
2026-06-13 21:30:12 +05:00

2.1 KiB

Settings — Notifications

Opt-in screen that starts / stops the NotificationPollingService. See Notifications for the polling service itself.


Fragment — SettingsNotificationsFragment

A programmatically-built ScrollView containing one toggle row and one nav row.

Enable Toggle

A SwitchCompat bound to the notifications_enabled preference (default false). Flipping it on triggers a multi-step setup; flipping it off stops the service and clears the pref.


Enable Flow

requestEnableNotifications() runs a permission chain. Each step proceeds to the next on grant; cancellation reverts the switch to off.

Step Code path When triggered
1. POST_NOTIFICATIONS permission permissionLauncher API 33+ only — skipped on older devices
2. Battery optimisation exemption batteryOptLauncher If PowerManager.isIgnoringBatteryOptimizations(packageName) == false, the user is sent to Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS
3. Start service enableService() Sets notifications_enabled = true, calls startForegroundService(NotificationPollingService), leaves the switch on

The battery-opt step proceeds to enableService() regardless of the user's choice — the service will still run but Android may throttle it without the exemption.


Disable Flow

disableService():

  1. Sets notifications_enabled = false
  2. stopService(NotificationPollingService) — the foreground notification disappears
  3. Switch state is forced back to off

Per-channel notification toggles remain in their last state on the system side — re-enabling re-creates the channels if needed.


Open System Channels

A second row labelled "Open system notification settings" launches Settings.ACTION_APP_NOTIFICATION_SETTINGS with the app's package extra. This is the only way to silence individual bank+profile channels created by the polling service (bank_bml_{loginId}, bank_mib_{loginId}).


 


← Circular Nav     Next → Settings — About