I'm trying to change targeting version to Android 12 (S). But I have an error
java.lang.IllegalArgumentException: : 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.
The code, that producing this error is:
return regRestClient.getToken(idRef)
.onErrorResumeNext(
regRestClient.registerDevice(idRef, Build.PRODUCT, Build.MODEL)
.flatMap(response -> regRestClient.getToken(idRef))
)
.map((result) ->
new TokenResult(result.getToken())
)
.doOnError(error -> provideActivityToConsumer(activity -> onRegFailed(activity, error)))
.onErrorReturn(throwable -> new TokenResult(null));
Get device token query:
@GET("device/{deviceId}")
@Headers( {Api.HEADER, Api.AUTH})
Single<TokenResult> getToken(@Path("idd") IdRef id);
I don't understand, it seems that RxJava libraries or retrofit libraries have some PendingIntent functionality, but I don't understand which exactly library.
my libraries:
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'io.reactivex.rxjava2:rxjava:2.2.18'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.9.0'
Please help!
Just add this dependency to your app module and everything will be good by some reason.
There is source of information: https://developer.android.com/jetpack/androidx/releases/work#version_27_2