easypermissions
easypermissions copied to clipboard
OnActivityResult Deprecated in latest Android X AppCompatActivity
Basic Information
Device type: Android with version 10 and 11 OS version: Android 10 and Android 11 EasyPermissions version: 3.0.0
Describe the problem
AppSettings dialog need onActivityResult for Appsettings dialog callback. And for this case, onActivityResult is deprecated on latest Android X Appcompat activity version.
https://developer.android.com/training/basics/intents/result
@GulajavaMinistudio onRequestPermissionsResult also deprecated and I am also waiting for new version , if you found something please write down below so it will be helpful for me Thanks :)
@vishalkumarsinghvi did they confirm they will update the lib that will handle that deprecation?
@chitgoks No response
I also wish they would update the library but you can still use an activity launcher without even modifying the library:
AppSettingsDialog dialog = new AppSettingsDialog.Builder(this).build();
@SuppressLint("RestrictedApi") Intent intent = AppSettingsDialogHolderActivity.createShowDialogIntent(this, dialog);
appSettingsDialogLauncher.launch(intent);
and your launcher in your activity or fragment would look like this:
private final ActivityResultLauncher<Intent> appSettingsDialogLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> {
// handle result here
});