Trying to add reply action to the notifications But no matter what I make, still gives me this error:
PendingIntents attached to actions with remote inputs must be mutable
app/build.gradle:
android {
compileSdkVersion 33
ndkVersion '23.1.7779620'
defaultConfig {
minSdkVersion 23
targetSdkVersion flutter.targetSdkVersion
}
dependencies {
implementation "com.android.support:support-compat:28.0.0"
implementation 'androidx.work:work-runtime-ktx:2.7.1'
implementation 'androidx.preference:preference-ktx:1.2.0'
}
}
PendingIntent:
PendingIntent replyPendingIntent;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
replyPendingIntent =
PendingIntent.getActivity(getApplicationContext(), channel.uuid.hashCode(), replyIntent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
} else {
replyPendingIntent =
PendingIntent.getActivity(getApplicationContext(), channel.uuid.hashCode(), replyIntent, PendingIntent.FLAG_UPDATE_CURRENT);
}
RemoteInput:
RemoteInput remoteInput = new RemoteInput.Builder("reply_chat")
.setLabel("Reply")
.build();
NotificationCompat.Action:
NotificationCompat.Action replyAction =
new NotificationCompat.Action.Builder(
R.drawable.ic_verified_badge,
"Reply", replyPendingIntent)
.addRemoteInput(remoteInput)
.build();