做出反应 native:how 以了解设备已植根?

react native:how to understand device is rooted?

我想知道设备是否已root?我查看了 react native library 以及 expo,但没有找到任何东西。

我还想在 phone 上获得已安装应用程序的列表。

您可以使用此库来识别 phone 是根目录还是模拟位置。

https://github.com/GantMan/jail-monkey

import JailMonkey from 'jail-monkey'

// is this device JailBroken on iOS/Android?
JailMonkey.isJailBroken()

// Can this device mock location - no need to root!
JailMonkey.canMockLocation()

// Check if device violates any of the above
JailMonkey.trustFall()

// (ANDROID ONLY) Check if application is running on external storage
JailMonkey.isOnExternalStorage()