I want to check in my device whether a custom ROM is installed or not. I don't want my app to run if there is a custom ROM on any device. How could I know this through code?
System.getProperty("os.version"); // OS version
android.os.Build.VERSION.SDK // API Level
android.os.Build.DEVICE // Device
android.os.Build.MODEL // Model
android.os.Build.PRODUCT // Product
Use this and then compare it with the Google stock images.
Check this answer as well.
One more thing, almost 99% of all the custom ROMs are rooted so you could check whether the device is rooted or not. The RootTools
library offers simple methods to check for root:
RootTools.isRootAvailable()
Get the RootTools library.