LocalNotification

Represents a local notification that can be scheduled to be shown at a specific time in the future.

Local notifications are displayed by the Android system without requiring server-side push delivery. They are useful for app-initiated reminders, time-based alerts, and user engagement features that don't depend on network connectivity.

Key Features:

  • Schedule notifications to appear after a specified delay
  • Support all push notification features: images, links, custom data
  • Manage scheduled notifications via LocalNotificationRequest
  • Compatible with notification settings and multi-notification mode

Quick Start:


  // Schedule a workout reminder for 1 hour from now
  LocalNotification reminder = new LocalNotification.Builder()
      .setMessage("Time for your daily workout!")
      .setDelay(3600) // 1 hour in seconds
      .build();

  LocalNotificationRequest request = Pushwoosh.getInstance()
      .scheduleLocalNotification(reminder);

  // Save request ID to cancel later if needed
  int requestId = request.getRequestId();

Important Notes:

  • Delay is specified in seconds, not milliseconds
  • Uses the same notification format as remote push notifications
  • Notifications persist across app restarts (stored in database)
  • Use setTag to control notification replacement behavior
  • Local notifications are subject to Android system battery optimization

See also

Types

Link copied to clipboard
open class Builder
Builder for creating LocalNotification instances.