In Xiaomi phones, when I try to redirect to a browser on the click of a notification using the following code :
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
try {
context.startActivity(intent);
} catch (ActivityNotFoundException e) {
Log.e(TAG, e.getMessage());
}
Redirect is not working and it is throwing an error that "Calling startActivity() from outside of an Activity context requires the
FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?".
I am
It is working fine in other phones. Can anyone help in solving this?