How to determine if OS is a custom ROM from an App?

爱⌒轻易说出口 提交于 2019-12-07 18:51:22

问题


I'm developing an Android application, but I want to restrict my application to only be accessible by hardware that is not running a rooted/custom ROM. I know about Android's Forward Locking content protection, but would like to double check this protection from within my app. Is there any way to get the signature of the device along with a trusted signature of the ROM using android API's so that I lock my app out from Custom ROMs?


回答1:


There is no fail-proof way that I can think of, sorry. The main point of a ROM or root is that you can change whatever you want. Therefore, none of the Android API calls are safe from modifications e.g. there is no call that would 100% let you know you are running on a legit device.

Update: Check out Google Safety Net, it may allow you to ensure that a device is non-modified. From what I read, safety net is supposed to let you check if a device is "compatible" with what google says are the corrent "android" APIs




回答2:


This question has some information on determining whether a device is running a custom ROM:

How to find out who the ROM provider is?




回答3:


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



来源:https://stackoverflow.com/questions/3843841/how-to-determine-if-os-is-a-custom-rom-from-an-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!