The app is crashing when I'm trying to open a file. It works below Android Nougat, but on Android Nougat it crashes. It only crashes when I try to open a file from the SD card, not from the system partition. Some permission problem?
File file = new File("/storage/emulated/0/test.txt");
Intent intent = new Intent(Intent.ACTION_VIEW);
startActivity(intent); // Crashes on this line
file:///storage/emulated/0/test.txt exposed beyond app through
When targeting Android Nougat,
file:// URIs are not allowed anymore. We should use
content:// URIs instead. However, my app needs to open files in root directories. Any ideas?