Effective way to programmatically check if I am deploying on Android?

This seems to work, but I'm not sure, as I am limited (AVD) in my ability to test it. I came up with this algorithm to check if I am teaching. Do you think this will always work? I'm not sure.

private boolean isRooted() { try { Process process = new ProcessBuilder() .command("/system/bin/su") .redirectErrorStream(false) .start(); } catch (IOException e) { return false; } return true; } 
+1
java android
source share

No one has answered this question yet.

See similar questions:

23
Determine if an Android device is running programmatically?
8
How to check if Android phone is installed?
4
How to determine if a device is associated with an application?

or similar:

2097
Is there a way to run Python on Android?
1367
The fastest way to determine if an integer square root is an integer
890
How to check if the service is running on Android?
882
A static way to get "Context" in Android?
757
What is the easiest and most reliable way to get the user's current location on Android?
617
How to check Internet access on Android? InetAddress never runs out
498
How to check the visibility of the software keyboard in Android?
386
Check your orientation on your Android phone
0
Android: How does “su” work in root AVD just like it does on a real root device?
-one
Is this a reliable way to test root on Android?

All Articles