Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
shankari opened this issue May 22, 2023 · 0 comments
Open

Comments

@shankari
Copy link

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

This is by design.
0b6aefe
added in the following code

Action[] actions = options.getActions();

        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).

  • Clicking on the action will launch the app and perform the action
  • Clicking on the notification will launch the app without performing the action

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

  • Plugin version: 0.1.4
  • Platform: android
  • OS version: all
  • Device manufacturer / model: all
  • Cordova version (cordova -v): 11.1.0
  • Cordova platform version (cordova platform ls): android 11.0.0
  • Plugin config
  • Ionic Version (if using Ionic) ionic1

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

  • Create a notification with actions.
  • Click on the notification
  • Nothing happens

Context

  • Get a notification to work both with clicks and actions

Debug logs

Please see link to code above

shankari added a commit to e-mission/cordova-plugin-local-notification-12 that referenced this issue Jun 12, 2023
… present

In bhandaribhumin@0b6aefe,
the plugin started ignoring regular clicks when actions are present.

```
        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;
        }
```

It is not clear why this was done. I have filed
bhandaribhumin#9
but not received any response

While waiting for it to be fixed in the main repo, commenting out that code in
a fork so that we can unblock out project.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant