에뮬레이터인지 확인방법
private var sIsProbablyRunningOnEmulator: Boolean? = null
fun isProbablyRunningOnEmulator(): Boolean {
var result = sIsProbablyRunningOnEmulator
if (result != null)
return result
result = (Build.FINGERPRINT.startsWith("google/sdk_gphone_")
&& Build.FINGERPRINT.endsWith(":user/release-keys")
&& Build.MANUFACTURER == "Google" && Build.PRODUCT.startsWith("sdk_gphone_") && Build.BRAND == "google"
&& Build.MODEL.startsWith("sdk_gphone_"))
|| Build.FINGERPRINT.startsWith("generic")
|| Build.FINGERPRINT.startsWith("unknown")
|| Build.MODEL.contains("google_sdk")
|| Build.MODEL.contains("Emulator")
|| Build.MODEL.contains("Android SDK built for x86")
|| "QC_Reference_Phone" == Build.BOARD && !"Xiaomi".equals(Build.MANUFACTURER, ignoreCase = true)
|| Build.MANUFACTURER.contains("Genymotion")
|| Build.HOST.startsWith("Build")
|| Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic")
|| Build.PRODUCT == "google_sdk"
|| SystemProperties.getProp("ro.kernel.qemu") == "1"
sIsProbablyRunningOnEmulator = result
return result
}
0 comments:
댓글 쓰기