我需要我的安卓apk的逻辑,如果手机是植根的,那么它应该向用户显示一个弹出窗口,说明您使用root设备并退出apk。有人帮助TIA..
首先在 gradle 中实现下面的库,
implementation 'com.scottyab:rootbeer-lib:0.0.7'
并运行下面的代码以检查设备是否为 root。
RootBeer rootBeer = new RootBeer(context);
if (rootBeer.isRooted()) {
//we found indication of root
} else {
//we didn't find indication of root
}
来源 : Git