enableNotifications
Enables or disables push notifications for the app.
This provides app-level control over whether push notifications are shown, independent of system notification permissions. When disabled, notifications will not be displayed even if system permissions are granted.
Use this for implementing user preferences or temporary "Do Not Disturb" modes. Example:
// User preference toggle
public void onNotificationToggle(boolean enabled) {
PushwooshNotificationSettings.enableNotifications(enabled);
SharedPreferences prefs = getSharedPreferences("app", MODE_PRIVATE);
prefs.edit().putBoolean("notifications_enabled", enabled).apply();
Toast.makeText(this,
enabled ? "Notifications enabled" : "Notifications disabled",
Toast.LENGTH_SHORT).show();
}
// Temporary disable during onboarding
public void startOnboarding() {
PushwooshNotificationSettings.enableNotifications(false);
}
public void finishOnboarding() {
PushwooshNotificationSettings.enableNotifications(true);
}
// Focus mode toggle
public void setFocusMode(boolean focusModeOn) {
if (focusModeOn) {
PushwooshNotificationSettings.enableNotifications(false);
Log.d("App", "Focus mode: notifications disabled");
} else {
PushwooshNotificationSettings.enableNotifications(true);
Log.d("App", "Focus mode off: notifications enabled");
}
}
Content copied to clipboard
Parameters
on
true to enable notifications, false to disable