Enum ForegroundServiceNotificationOptions.TapAction

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      DO_NOTHING
      Do nothing when tapping the Notification.
      LAUNCH_APP
      Launch the app's main activity using the information returned by PackageManager.getLaunchIntentForPackage(String).
      LAUNCH_SETTINGS
      Launch the operating system settings screen for the current app.
    • Enum Constant Detail

      • LAUNCH_APP

        public static final ForegroundServiceNotificationOptions.TapAction LAUNCH_APP
        Launch the app's main activity using the information returned by PackageManager.getLaunchIntentForPackage(String).

        The Intent used with LAUNCH_APP contains an extra SITUM_EXTRA_LAUNCH_APP that allows you to detect whether the app launch comes from a notification. You can check this extra in your activity to determine the source of the launch.

        
         protected void onCreate(Bundle savedInstanceState) {
             super.onCreate(savedInstanceState);
             setContentView(R.layout.activity_main);
        
             Intent intent = getIntent();
             if (intent != null && intent.hasExtra(ForegroundServiceNotificationOptions.SITUM_EXTRA_LAUNCH_APP)) {
                 // Handle the launch from the notification
                 handleNotificationLaunch();
             } else {
                 // Handle the normal launch
                 handleNormalLaunch();
             }
         }
         
    • Method Detail

      • values

        public static ForegroundServiceNotificationOptions.TapAction[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (ForegroundServiceNotificationOptions.TapAction c : ForegroundServiceNotificationOptions.TapAction.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static ForegroundServiceNotificationOptions.TapAction valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null