[android] fail gracefully when ACTION_CHANNEL_NOTIFICATION_SETTINGS is not available

This commit is contained in:
Torsten Grote
2019-11-05 15:17:10 -03:00
parent 383367f0c8
commit 72aa5397f8
2 changed files with 8 additions and 1 deletions

View File

@@ -489,7 +489,13 @@ public class SettingsFragment extends PreferenceFragmentCompat
Intent intent = new Intent(ACTION_CHANNEL_NOTIFICATION_SETTINGS)
.putExtra(EXTRA_APP_PACKAGE, packageName)
.putExtra(EXTRA_CHANNEL_ID, channelId);
startActivity(intent);
Context ctx = requireContext();
if (intent.resolveActivity(ctx.getPackageManager()) != null) {
startActivity(intent);
} else {
Toast.makeText(ctx, R.string.error_start_activity, LENGTH_SHORT)
.show();
}
return true;
});
}