bhandaribhumin / cordova-plugin-local-notification-12

Apache License 2.0
17 stars 35 forks source link

When actions are present, clicking on the notification is a NOP, why? #9

Open shankari opened 12 months ago

shankari commented 12 months ago

The plugin does makes the notification non-clickable if actions are defined.

This is by design. https://github.com/bhandaribhumin/cordova-plugin-local-notification-12/commit/0b6aefe0aac71cf44feb62a975516e13adfd010e added in the following code

https://github.com/bhandaribhumin/cordova-plugin-local-notification-12/blob/17826eae5e0a857a2b4051d30032b4e5c767d2be/src/android/notification/Builder.java#L407

        Action[] actions = options.getActions();
        if (actions != null && actions.length > 0 ) {
          // if actions are defined, the user must click on button actions to launch the app.
          // Don't make the notification clickable in this case
          return;
        }

But did not add any reason. Is it possible to have that functionality controlled by an option (e.g. "make_unclickable_if_actions") instead?

Because a lot of other apps (e.g. SMS app/gmail) support both functionality - the notification will show some text and a couple of buttons (Mark Read and/or Delete).

In fact, the android notification docs say (note the in addition to)

Although it's not required, it's a good practice for every notification to open an appropriate app activity when it's tapped. In addition to this default notification action, you can add action buttons that complete an app-related task from the notification—often without opening an activity—as shown in figure 8.

Your Environment

Expected Behavior

we should be able to configure our notification to support both clicks and actions

Actual Behavior

if actions are configured, clicks are disabled

Steps to Reproduce

Context

Debug logs

Please see link to code above