I am facing this issue while upgrading the targetSDK to 31 (Android 12)
I am using react native, A package called react-native-sms-retriver There is a PendingIntent used in PhoneNumberHelper.java
final GoogleApiClient googleApiClient = getGoogleApiClient(context);
final PendingIntent intent = Auth.CredentialsApi
.getHintPickerIntent(googleApiClient, request);
try {
activity.startIntentSenderForResult(intent.getIntentSender(),
REQUEST_PHONE_NUMBER_REQUEST_CODE, null, 0, 0, 0);
} catch (IntentSender.SendIntentException e) {
promiseReject(SEND_INTENT_ERROR_TYPE, SEND_INTENT_ERROR_MESSAGE);
callAndResetListener();
} finally {
if (googleApiClient.isConnected()) {
googleApiClient.disconnect();
}
}
How can i fix this?
I have tried the following to no avail
- adding
implementation 'androidx.work:work-runtime:2.7.1'
inandroid/build.gragle
- adding
implementation 'com.google.android.gms:play-services-base:18.1.0' implementation 'com.google.android.gms:play-services-basement:18.1.0'
in app/build.gradle
I have seen the following code in similar questions but not sure how to use it in my case
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
return PendingIntent.getActivity(context, id, intent, PendingIntent.FLAG_IMMUTABLE | flag);
} else {
return PendingIntent.getActivity(context, id, intent, flag);
}
I am not sure how to use it since there is no PendingIntent.getActivity()
in the packages code.