-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Android: Tapping a notification causes second OnCreate()
call and crash.
#14924
Comments
We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process. |
I think putting |
Thanks @AmrAlSayed0 - unfortunately this still fails in exactly the same way if the user taps the notification and the activity is in the foreground already, but does fix the issue of tapping when the activity is in the background. EDIT: To clarify, when I say "this" doesn't work, I mean either of the proposed values for |
Same issue here, I'm using Notifications from the Shiny.org lib |
I am having same issue. Anyone have a workaround for this? |
Me too |
Changing to |
This only works if killing the activity kills the app process as essentially when you tap the notification you're getting a totally fresh copy of your app. If you run foreground services etc. unfortunately, it has no effect and the crash still occurs as your app has an existing process running. |
Verified this on Visual Studio Enterprise 17.7.0 Preview 2.0. Repro on Android 13.0-API33 with below Project: |
Still a problem. |
It appears to be crashing somewhere in the base.OnStart() method. I can't figure out how to debug or at least see what's going on. |
Still a big issue. We are using .NET 8 and this is preventing us from releasing a version. Any update? |
Hi, |
Unfortunately, the solution in the video doesn't work if you kill the activity via a "swipe up" but the app contains background processing such as a foreground service (see my note above). The problem remains and cannot be worked around by adjusting the activity type. |
@edwinjoelmarte could you please provide more detail regarding where and when in the lifecycle of the app are you doing this exactly to overcome the issue? |
That's assigned to the intent that's captured in the notification. |
This is a problem for me also, using Shiny.Notifications library |
Description
I start with an application which generates a notification. I opted to use a foreground service to generate the notification however it doesn't seem to make a difference how the notification is generated.
The notification in the foregroun service is created like so;
I start the service in the
![image](https://user-images.githubusercontent.com/4292237/236233470-1f6170a0-47da-4034-8cf4-fad7a472c1d5.png)
![image](https://user-images.githubusercontent.com/4292237/236233594-e6182a20-5f75-4780-992a-6f32fca81545.png)
OnCreate
lifecycle callback, which results in an app with the notification present;When the user taps on the notification two things happen;
1l The
OnCreate
lifecycle activity is called again for the same activity instance it got called for on startup. There is no call onOnDestroy
.Steps to Reproduce
Link to public reproduction project repository
https://github.com/RobTF/mauiplay/tree/master/NotificationTapIssue
Version with bug
7.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 13
Did you find any workaround?
No
Relevant log output
The text was updated successfully, but these errors were encountered: