AppNotificationManagerDemo1 crashes when running on android13 (solved) lazarus / 43-Android ---------------------------------------------------------------------- iwizard · 2024-02-08 01:37 I compiled and ran AppNotificationManagerDemo1, unfortunately, my attempt failed under android13, the program crashed after clicking the Push System Notification button, but my phone using android4.1 also ran successfully, what is the reason, how do I need to troubleshoot and solve the problem? ---------------------------------------------------------------------- marcos-ebm · 2024-02-08 05:57 [using the translator] From what I've noticed, it doesn't work on new phones because of the appcompat theme. on old smartphones, it works with the default theme (deviceDefault) I believe the NotificationManager component is not updated to use appCompat ---------------------------------------------------------------------- marcos-ebm · 2024-02-08 07:10 [using the translator] The component is working perfectly, there is something in the Demo that is bad, but as it is a Demo, it is better not to use it do it like this Create a new project, add only the NotificationManager1 component to the form create a button and place the code in the button's onClick Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TAndroidModule1.Button1Click(Sender: TObject);begin   NotificationManager1.Notify();end; try it It's better to use the Demos just to see the codes As the Lamw project changed over time, the Demos didn't keep up, but over time everything got better. ---------------------------------------------------------------------- iwizard · 2024-02-08 09:10 Thanks for the reply, I created a new project, put a button and a jNotificationManager control on it, wrote the code in the click event of the button NotificationManager1.Notify(); No error is reported when the execution is executed, but the Notify message does not appear. In addition, I found that the crash in the demo problem was not caused by jNotificationManager, but by jIntentManager, which was caused by jNotificationManager1.SetContentIntent(......) Comment out, demo does not report error under android13, but again, the notify notification message does not appear after the code is executed. ---------------------------------------------------------------------- Insid3Code · 2024-02-08 16:54 Hi, It related to missing required flag for PendingIntent. EXCEPTION MSG: Quotecalled with pending exception java.lang.IllegalArgumentException: com.example.appnotificationmanagerdemo1: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles. GAIN NOTIFICATIONS PERMISSION: 1- manifest side: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i 2- use runtime permission call to ask user. See animated gif: https://i.imgur.com/aDPkQOC.gif ---------------------------------------------------------------------- iwizard · 2024-02-09 03:08 Thank you very much for your guidance, I now use AndroidStudio to open the project after modification, and use AndroidStudio to compile and install can pop up the notify prompt window! ---------------------------------------------------------------------- iwizard · 2024-02-09 03:21 In addition, I experimented with it, as long as I added permission, the notify pop-up window was also correctly popped up when I compiled and ran it directly in Lazarus, and I didn't need to open AndroidStudio to adjust jNotificationManager.java code, thanks again to everyone for their help! ---------------------------------------------------------------------- jmpessoa · 2024-02-11 01:27 Fixed and Update! Thanks to All!