I want to get external and internal storage in my application. I am using this code
Scanner scanner = new Scanner(new File("/etc/vold.fstab"));
while (scanner.hasNext()) {
String line = scanner.nextLine();
if (line.toLowerCase().contains("dev_mount")) {
if (line.toLowerCase().contains("nonremovable")) {
VoldMounts.put(line.split(" ")[2],true);
}else {
VoldMounts.put(line.split(" ")[2],false);
}
}
}
It works fine on Android 4.2.2 and below, but on Android 4.3 the file is changed to /fstab.<device>, and this file needs root access. How to read fstab without root access? I do not want to use / proc / mount.
Thanks.
source
share