Pushwoosh / pushwoosh-appcelerator-titanium

Other
33 stars 16 forks source link

Android 12 crash (SDK Target 31) #87 #89

Closed macasfaj closed 1 year ago

macasfaj commented 1 year ago

Good morning, sorry but using 6.1.0 version and the issue is still there. :( There is a FLAG that must be updated. @wfhm

03-02 09:15:48.373 25396 25461 E AndroidRuntime: FATAL EXCEPTION: pool-11-thread-1 03-02 09:15:48.373 25396 25461 E AndroidRuntime: Process: com.gosupernova.app, PID: 25396 03-02 09:15:48.373 25396 25461 E AndroidRuntime: java.lang.IllegalArgumentException: com.gosupernova.app: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. 03-02 09:15:48.373 25396 25461 E AndroidRuntime: 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 bubb

wfhm commented 1 year ago

@macasfaj this is really weird - I've tried it today multiple times on Android 13 device and everything worked just fine. Could you please send us a simple reproducer project so we could see what's going on there?

macasfaj commented 1 year ago

have you tried on Android 12 + targetSDK = 31?

If it's works for you, I'll send a project with that issue.

wfhm commented 1 year ago

I used targetSdkVersion 33, so that covers your case as well. All PendingIntent usages in our SDK were updated with these flags almost two years ago, so this is something really strange - it should be working even with older versions (down to 6.0.5). So I believe we really need to have a look at what's going on in your project. You can send it via a support ticket at https://help.pushwoosh.com/hc/en-us/requests/new

macasfaj commented 1 year ago

Ok, let me have a look. Thanks!

macasfaj commented 1 year ago

Project is being sent into a ticket! We've cleaned all the controllers and still fails.

If you remove "com.pushwoosh.module"... it runs! If you add it again, fails.

If targetSDK=30... it always works

Thanks!

wfhm commented 1 year ago

@macasfaj got it. Will check it now.

wfhm commented 1 year ago

@macasfaj In your app/platform/android/build.gradle you force resolution of the work-runtime module to 2.5.0:

resolutionStrategy.force 'androidx.work:work-runtime:2.5.0'

If you check source code of this version of this module, you'll see that it does not have the required flags:

    public boolean isForceStopped() {
        // Alarms get cancelled when an app is force-stopped starting at Eclair MR1.
        // Cancelling of Jobs on force-stop was introduced in N-MR1 (SDK 25).
        // Even though API 23, 24 are probably safe, OEMs may choose to do
        // something different.
        PendingIntent pendingIntent = getPendingIntent(mContext, FLAG_NO_CREATE);
        if (pendingIntent == null) {
            setAlarm(mContext);
            return true;
        } else {
            return false;
        }
    }

Could you please try updating to version 2.7.1? Please let me know about the results.

macasfaj commented 1 year ago

Updating to version 2.7.1 WORKS!!! This ticket can be closed.

Thanks a lot @wfhm !!!!!!!! 👏🏻

wfhm commented 1 year ago

@macasfaj Great news, I'm happy I could help:)