I'm using Firebase with facebook-login and receiving the following error:
Caused by: java.lang.IllegalArgumentException: my.app.id: 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)
at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:645)
at android.app.PendingIntent.getBroadcast(PendingIntent.java:632)
at com.facebook.AccessTokenManager.setTokenExpirationBroadcastAlarm(AccessTokenManager.kt:121)
at com.facebook.AccessTokenManager.setCurrentAccessToken(AccessTokenManager.kt:94)
at com.facebook.AccessTokenManager.setCurrentAccessToken(AccessTokenManager.kt:47)
at com.facebook.AccessToken$Companion.setCurrentAccessToken(AccessToken.kt:428)
at com.facebook.AccessToken.setCurrentAccessToken(Unknown Source:2)
at com.facebook.login.LoginManager.finishLogin(LoginManager.java:894)
at com.facebook.login.LoginManager.onActivityResult(LoginManager.java:247)
at com.facebook.login.LoginManager$1.onActivityResult(LoginManager.java:186)
The gradle library entry I'm using is:
implementation 'com.facebook.android:facebook-login:11.2.0'
It seems like the setTokenExpirationBroadcastAlarm code isn't setting the flag. Has anyone got a workaround for this or idea of what I'm doing wrong?
My code calls this in onActivityResult when the user has signed in:
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
// Pass the activity result back to the Facebook SDK
facebookCallbackManager.onActivityResult(requestCode, resultCode, data)
}
I'm testing this on a Pixel with Android 12.
This problem was solved in the following version of the Facebook
sdk 12.3.0.
add/change to this line
implementation 'com.facebook.android:facebook-android-sdk:12.3.0'
Facebook resolved this issue in 11.3.0 version.
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.facebook.android:facebook-android-sdk:11.3.0'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With