Pick the fix
Since targeting Android 11, intent.resolveActivity(packageManager) returns null and the Share button hides, even though email apps are installed. Best fix?
Hint 1 of 1
Is the problem starting the intent, or asking who can handle it?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A Call startActivity directly and catch ActivityNotFoundException, or add a <queries> entry
Correct. Package visibility hides other apps from queries, not from starting them.
Why not the others?
- B Request QUERY_ALL_PACKAGES. Play restricts that permission to apps that truly need it.
- C Use an explicit intent to a mail app's package. That only works for one app and breaks if it isn't installed.
- D Lower targetSdk. Play requires a recent target.