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

Action buttons has no effect if app is closed #423

Open
Bindslev opened this issue Jun 11, 2023 · 17 comments
Open

Action buttons has no effect if app is closed #423

Bindslev opened this issue Jun 11, 2023 · 17 comments
Assignees
Labels
Android Android only issue Configuration Issue Configuration Issue

Comments

@Bindslev
Copy link

Bindslev commented Jun 11, 2023

Describe the bug
If I receive a notification either with the app open or closed, if I then close the application, the action button presses I make are ignored and the notification will simply just stay in the notification tray with no action taken.

If the app is then opened, the notification will now work and clicking the action button will dismiss the notification and run the code that it should.

To Reproduce
Steps to reproduce the behavior:

  1. Trigger a notification in Android with an action button
  2. Release it in "Release" mode so that the application can be fully closed
  3. Click the action button and notice how nothing happens
  4. Open back up the app to confirm that it does indeed work as long as the app is not closed

Expected behavior
I was expecting the action buttons to behave equally when the app is open vs closed

Screenshots
I'll gladly do if my description don't suffice

Platform (please complete the following information):

  • OS: Android
  • Version OxygenOS 11.1.2.2

Smartphone (please complete the following information):

  • Device: OnePlus 6t and Samsung tablet Galaxy Tab S5e
  • OS: OxygenOS
  • Version: 11.1.2.2

Additional context
I have minimum code to generate the notification and action buttons, and I have scheduled the notifications if that makes any difference.
Also, no intentflags were set, as I'm unsure of what exactly those does (maybe related?)

@Bindslev Bindslev added the bug Something isn't working label Jun 11, 2023
@thudugala
Copy link
Owner

@Bindslev Can you please attach a sample project?

@Bindslev
Copy link
Author

I can try and look into it. I couldn't get the sample app to work previously, but I'll give in another try and see if I can replicate it there.
Is the issue clear besides that?

@thudugala thudugala added the Android Android only issue label Jun 17, 2023
@Bindslev
Copy link
Author

Issue423.zip

Here's a sample project @thudugala
I couldn't get the sample project in this repo to build, so I built a little one from the MAUI template.
How to run it:
Just start it in Release mode. After the app is booted up, it should automatically send you a notification with two action buttons.
Before clicking the action buttons, please close the app on your device, and then try and click one of the two action buttons. On my two devices, nothing happens and I would expect the notification actions to trigger + the notification should be dismissed from the notification tray.

Thanks for looking into it

@thudugala
Copy link
Owner

@Bindslev do you see the same results in the emulator?

@Bindslev
Copy link
Author

@thudugala I haven't actually run any, my computer is not very happy about running emulators (Extremely slow) so I tend to only test on my devices. Are you able to replicate using the attached sample?

@thudugala
Copy link
Owner

@Bindslev

try setting LaunchAppWhenTapped to true

image

@thudugala thudugala added Configuration Issue Configuration Issue and removed bug Something isn't working labels Jun 25, 2023
@Bindslev
Copy link
Author

Unfortunately that didn't work.
Although the behavior changed; the app will now open when I click the action buttons, but the action themselves are not triggered, and I wouldn't expect the app to open when using the action buttons.
Does this work for you? Could there be other settings that need to be set?

@thudugala
Copy link
Owner

@Bindslev Can you also try setting the IconName?

image

@thudugala
Copy link
Owner

untitled

@Bindslev
Copy link
Author

Hmm yeah that's weird. It doesn't seem to work for me on any of my devices.
I also tried adding a DisplayAlert after clicking the action button, but it only gets triggered if the app is already open.
If the app has been closed (as in your demonstration) it simply opens up the app and doesn't trigger the code that is normally executed when clicking the action buttons, even when adding the iconName.
Could it be anything else you think? Have you tested on a physical device?

@Bindslev
Copy link
Author

Any news @thudugala? And is there no way to use action buttons while the app is closed without them opening up the app? Normally when using action buttons, the idea is the app doesn't need to open up, so I'm a bit curious to know whether this is possible at all? Because otherwise my users might as well just click on the notification without use of action buttons, thanks!

@thudugala
Copy link
Owner

@Bindslev try setting LaunchAppWhenTapped to false

@Bindslev
Copy link
Author

Bindslev commented Jul 22, 2023

@thudugala Does not work. Same issue, nothing happens when clicking the action buttons. Again - does it work for you on a device, without the action button opening up the app?

@thudugala
Copy link
Owner

@Bindslev Yes, in the example, the close action button closes the notification without opening the app.

@Bindslev
Copy link
Author

@thudugala Very interesting. I know it's much asking this, but could you modify my sample project I attached here to make it work? I tried all your suggestions, but when closing the app, the action buttons are completely unresponsive for me and does not trigger any action button code. I was therefore wondering if anything else in your sample project may contribute to this working for you? I tried on two devices but still no luck

@Bindslev
Copy link
Author

For the record, I just tested the same thing on iPhone and it works the exact same way as I reported on Android. Could I have missed something in the setup that allows notification actions to work when the app has been closed? Action buttons work on iPhone when the app has not been closed, but when the app has been closed and I click the button, the notification will actually disappear as it is supposed to, but the code that should be run according to the action clicked, is not run at all unfortunately.

@Bindslev
Copy link
Author

Bindslev commented Sep 1, 2023

Any news @thudugala? I still don't have a working example and it's both Android and iOS so might want to add that label. Are you sure this is a configuration issue? I feel like I have tried most things by now but with the same results on both OS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android Android only issue Configuration Issue Configuration Issue
Projects
None yet
Development

No branches or pull requests

2 participants