How to correct missing pending intent on android 12 in a third party library?

948 Views Asked by At

I have a 3rd party library that uses pending intent and my app crushes on android 12 because of that:

java.lang.IllegalArgumentException: com.myapp: 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. at android.app.PendingIntent.checkFlags(PendingIntent.java:375)

I try to add:

implementation 'androidx.work:work-runtime:2.7.1'

but the error continues.

I also tried to add:

allproject {
  project.configurations.all {
    resolutionStrategy {
      force 'androidx.work:work-runtime:2.7.0'
    }
  }
}

in my build.gradle and nothing.

The library I need to use is this one:

implementation 'org.puredata.android:pd-core:1.2.1-rc1'

<service android:name="org.puredata.android.service.PdService"
            android:foregroundServiceType="microphone|phoneCall" />

Any ideas how to make it work? Thanks

1

There are 1 best solutions below

0
On

Add the android:exported tag in your service or activity in manifest. For example:

android:exported="true"