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

In IOS local notification not triggering with action buttons #2055

Open
souvik-m-1305 opened this issue Jan 13, 2025 · 0 comments
Open

In IOS local notification not triggering with action buttons #2055

souvik-m-1305 opened this issue Jan 13, 2025 · 0 comments

Comments

@souvik-m-1305
Copy link

souvik-m-1305 commented Jan 13, 2025

After killing the app in IOS device, a notification with an action button appeared. When the action button was clicked, the app was launched. However, subsequent notifications were triggered, but the action buttons no longer appeared.

Your Environment

  • Plugin version: Release v1.1.0
  • Platform: IOS
  • OS version: 18.2
  • Device manufacturer / model: iPad (10th Gen)
  • Cordova version (12.0.0):
  • Cordova platform version (```ios@7.1.1``):
  • Plugin config [If you're referring to the config.xml, I haven't made any changes to it. It's too long to include here.]
  • Ionic Version ( not using Ionic)

Expected Behavior

Everytime after triggering notifications with action buttons, notification should come with action buttons

Actual Behavior

After killing the app, notification with action button appeared on clicking on action button invoking the app with after that the notifications are getting triggered but notification action buttons are not visible.

Steps to Reproduce

  1. After executing below snippet, kill the application
cordova.plugins.notification.local.hasPermission(function (granted) {
       if (!granted) {
           cordova.plugins.notification.local.requestPermission(function (isGranted) {
               if (isGranted) {
                   console.log('Notification permission granted');
               } else {
                   console.error('Notification permission denied');
               }
           });
       } else {
           console.log('Notification permission already granted');
       }
   });

actions = [
       { id: 'NO', title: "No", launch: true, foreground: true },
       { id: 'OK', title: "Okay", launch: true, foreground: true }
   ];

   if (device.platform === 'iOS') {
       cordova.plugins.notification.local.addActions('B_ACTION', actions);
   }
    mod = 10000
    for (let i=0; i<30; i++){
        mod  = mod + 5000
        cordova.plugins.notification.local.schedule({
            id: new Date().getTime(),
            title: 'APP ALERT!',
            foreground: true,
            launch: true,
            sticky: true,
            color: '#FF5733',
            actions: device.platform === 'iOS' ? 'B_ACTION' : actions,
            data: { alarm_time: String(1) },
            trigger: { at: new Date(new Date().getTime() + mod) }
        })   
    }
  1. In app killed state notifications will trigger with action buttons
  2. In the first notification action button will be visible on clicking action "Okay", app will invoke/open
  3. After app gets open, next notification onwards action buttons wont be visible

Context

I scheduled multiple notifications to be triggered in the future and then closed the app. Only the first notification appeared with action buttons, and when clicking on the action button, the app was launched. However, all the subsequent notifications did not have action buttons.

Debug logs

@katzer, @julianlecalvez, @ferryjagers and others, I hope you can assist me, as you all have expertise in this area. I'm in a critical situation and, unfortunately, I don't have the time to learn IOS Dev, nor am I able to at the moment.

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