nufus42 3 Posted March 4, 2023 Hi @all, I mostly surf the net if I'm stuck, but this seems to be a first timer for Delphi developers. No cerresponding answer pops up. I developed an app with 11.1 for Android target 30 including push notifications and local notifications. Works great. But... Play store says: you're not on level 31? You're not coming in! Alright; I do the manifest trick to fake SDK level 31. Play store accepts. I am happy. Until I try the first push notification with an app downloaded from Play Store: java.lang.IllegalArgumentException: <appname> Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. Dear god, ever heard of defaults, Google? So I installed SDK 31 since I assumed the problem would be solved by that. No, it's not. Is it the NDK? I did not update that, since I did not find a matching NDK (platform folder is missing or prebuilt etc.) I wish Embarcadero would maintain that better besides urgeing you to an update of Delphi. Would updating Delphi to 11.2 or 11.3 really help? That's time I would like to spare since I already crashed the deadline of this project due to the notification problem. Share this post Link to post
Dave Nottage 557 Posted March 4, 2023 2 hours ago, nufus42 said: I developed an app with 11.1 for Android target 30 including push notifications and local notifications 2 hours ago, nufus42 said: java.lang.IllegalArgumentException: <appname> Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. 2 hours ago, nufus42 said: Would updating Delphi to 11.2 or 11.3 really help? Unfortunately, no.. and I don't know why it was missed. There's a couple of spots in System.Android.Notification.pas (local notification support) where a PendingIntent is used and the flag is not being included. Best you could do right now is to copy the unit, put it somewhere in your project path and make the necessary modifications. Share this post Link to post
Remy Lebeau 1394 Posted March 4, 2023 15 hours ago, Dave Nottage said: There's a couple of spots in System.Android.Notification.pas (local notification support) where a PendingIntent is used and the flag is not being included. I don't see any tickets open in QualityPortal about that issue yet. Share this post Link to post
Dave Nottage 557 Posted March 4, 2023 47 minutes ago, Remy Lebeau said: I don't see any tickets open in QualityPortal about that issue yet. Indeed. According to the docs, setting a scheduled notification in this demo: https://github.com/Embarcadero/RADStudio11Demos/tree/main/Object Pascal/Mobile Snippets/Notifications/SendCancelNotification Should fail, but it doesn't. At this point I have no idea why - the target SDK level is 32, and a PendingIntent is being created without the MUTABLE or IMMUTABLE flags being included. Back to the drawing board: 18 hours ago, nufus42 said: java.lang.IllegalArgumentException: <appname> Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. You'll need to provide a reproducible example. Share this post Link to post
nufus42 3 Posted March 4, 2023 (edited) On 3/4/2023 at 4:29 AM, Dave Nottage said: Unfortunately, no.. and I don't know why it was missed. There's a couple of spots in System.Android.Notification.pas (local notification support) where a PendingIntent is used and the flag is not being included. Best you could do right now is to copy the unit, put it somewhere in your project path and make the necessary modifications. Believe it or not, your idea worked. I've extended the options of all the PendingIntents in System.Android.Notification (after copying to my project folder) with "or TJPendingIntent.JavaClass.FLAG_IMMUTABLE" and my error is gone and my weekend is saved (at least the sunday). Thanks man! I've read a lot of your comments, when I silently tried to find solutions for my problems and most of the time they at least helped me to find the right way. If our ways should ever cross (quite umlikely because we're living in totally different parts of the world - Germany here) I would be honored to be able to buy you a drink or two. Edited March 5, 2023 by nufus42 1 1 Share this post Link to post