首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >颤振:如何检测应用程序是否运行在LD播放器上

颤振:如何检测应用程序是否运行在LD播放器上
EN

Stack Overflow用户
提问于 2022-06-29 13:25:33
回答 2查看 449关注 0票数 0

我正在开发一个带有一些安全要求的应用程序,其中之一是防止该应用程序在仿真器中工作,这只是一个真实的设备,以防止屏幕截图和仿真器的屏幕记录。

我使用了设备加号包来检测应用程序是在模拟器上运行还是在物理设备上运行,每件事情都正常工作,但是当我尝试LD Player模拟器时,软件包无法检测到它是仿真器,因为它非常擅长模拟真实的设备。

因此,任何检测该设备是否运行在LD Player上的想法

下面是device_info_plus的输出,它可能会有帮助:

代码语言:javascript
运行
复制
{
  "id": "N2G48B",
  "host": "ubuntu",
  "tags": "release-keys",
  "type": "user",
  "model": "ASUS_Z01QD",
  "board": "SM-G975N",
  "brand": "asus",
  "device": "aosp",
  "product": "SM-G975N",
  "display": "N2G48B",
  "hardware": "android_x86",
  "androidId": null,
  "bootloader": "unknown",
  "version": {
    "baseOS": "",
    "sdkInt": 25,
    "release": "7.1.2",
    "codename": "REL",
    "incremental": "V9.5.8.0.OCACNFA",
    "previewSdkInt": 0,
    "securityPatch": "2017-10-05"
  },
  "fingerprint": "google/android_x86/x86:7.1.2/N2G48B/V9.5.8.0.OCACNFA:user/release-keys",
  "manufacturer": "asus",
  "supportedAbis": [
    "x86",
    "armeabi-v7a",
    "armeabi"
  ],
  "systemFeatures": [
    "android.hardware.sensor.proximity",
    "android.hardware.sensor.accelerometer",
    "android.software.controls",
    "android.hardware.faketouch",
    "android.hardware.usb.accessory",
    "android.software.backup",
    "android.hardware.touchscreen",
    "android.hardware.touchscreen.multitouch",
    "android.software.print",
    "android.hardware.ethernet",
    "android.software.activities_on_secondary_displays",
    "android.hardware.wifi.rtt",
    "com.google.android.feature.PIXEL_2017_EXPERIENCE",
    "android.software.voice_recognizers",
    "com.google.lens.feature.CAMERA_INTEGRATION",
    "android.software.picture_in_picture",
    "android.hardware.fingerprint",
    "android.hardware.sensor.gyroscope",
    "android.hardware.audio.low_latency",
    "android.software.vulkan.deqp.level",
    "com.google.android.feature.PIXEL_2018_EXPERIENCE",
    "android.hardware.opengles.aep",
    "android.hardware.bluetooth",
    "android.hardware.camera.autofocus",
    "com.google.android.feature.GOOGLE_BUILD",
    "android.hardware.telephony.gsm",
    "android.hardware.telephony.ims",
    "android.software.sip.voip",
    "android.hardware.vr.high_performance",
    "android.hardware.usb.host",
    "android.hardware.audio.output",
    "android.software.verified_boot",
    "android.hardware.camera.flash",
    "android.hardware.camera.front",
    "android.hardware.sensor.hifi_sensors",
    "android.hardware.se.omapi.uicc",
    "android.hardware.screen.portrait",
    "android.hardware.nfc",
    "com.google.android.feature.TURBO_PRELOAD",
    "android.hardware.sensor.ambient_temperature",
    "com.nxp.mifare",
    "android.hardware.sensor.stepdetector",
    "android.software.home_screen",
    "android.hardware.microphone",
    "android.software.autofill",
    "android.software.securely_removes_users",
    "android.software.vr.mode",
    "com.google.android.feature.PIXEL_EXPERIENCE",
    "android.hardware.bluetooth_le",
    "android.hardware.sensor.compass",
    "android.hardware.touchscreen.multitouch.jazzhand",
    "android.hardware.sensor.barometer",
    "android.software.app_widgets",
    "android.software.input_methods",
    "android.hardware.sensor.light",
    "android.hardware.vulkan.version",
    "android.software.companion_device_setup",
    "android.software.device_admin",
    "com.google.android.feature.WELLBEING",
    "android.hardware.wifi.passpoint",
    "android.hardware.camera",
    "com.google.android.feature.ZERO_TOUCH",
    "android.hardware.screen.landscape",
    "android.software.device_id_attestation",
    "android.hardware.ram.normal",
    "android.software.managed_users",
    "android.software.webview",
    "android.hardware.sensor.stepcounter",
    "android.hardware.camera.capability.manual_post_processing",
    "com.google.ar.core.depth",
    "android.hardware.camera.any",
    "android.hardware.camera.capability.raw",
    "android.software.connectionservice",
    "android.hardware.touchscreen.multitouch.distinct",
    "android.hardware.location.network",
    "android.software.cts",
    "android.software.sip",
    "android.hardware.camera.capability.manual_sensor",
    "android.software.app_enumeration",
    "com.google.android.apps.dialer.SUPPORTED",
    "android.hardware.camera.level.full",
    "android.hardware.wifi.direct",
    "android.software.live_wallpaper",
    "com.google.android.feature.GOOGLE_EXPERIENCE",
    "android.software.ipsec_tunnels",
    "com.google.android.feature.EXCHANGE_6_2",
    "android.software.freeform_window_management",
    "android.hardware.audio.pro",
    "android.hardware.nfc.hcef",
    "android.hardware.location.gps",
    "android.software.midi",
    "android.hardware.nfc.any",
    "android.hardware.nfc.hce",
    "android.hardware.wifi",
    "android.hardware.location",
    "android.hardware.vulkan.level",
    "android.hardware.wifi.aware",
    "android.software.secure_lock_screen",
    "android.hardware.telephony",
    "android.software.file_based_encryption",
    null
  ],
  "isPhysicalDevice": true,
  "supported32BitAbis": [
    "x86",
    "armeabi-v7a",
    "armeabi"
  ],
  "supported64BitAbis": []
}
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2022-06-29 13:42:35

解决方案是检查这些文件夹是否存在,如果其中任何文件夹存在,那么它就是一个LD Player

代码语言:javascript
运行
复制
'/storage/emulated/0/storage/secure',
'/storage/emulated/0/Android/data/com.android.ld.appstore'

我已经实现了一个方法,用于获取文件夹路径列表,如果存在文件夹路径,则返回true,如下所示:

代码语言:javascript
运行
复制
bool anyFolderExists(List<String> foldersPaths) {
   for (String folderPath in foldersPaths) {
     if (Directory(folderPath).existsSync()) {
       return true;
     }
   }
   return false;
}

我就是这样用的:

代码语言:javascript
运行
复制
List<String> harmfulFoldersPaths = [
  '/storage/emulated/0/storage/secure',
  '/storage/emulated/0/Android/data/com.android.ld.appstore',
];

if(anyFolderExists(harmfulFoldersPaths))
{
    print('LD Player Detected!');
}

此外,我还使用加号包输出中的这两个值来确定应用程序是否在运行仿真程序,因为它们看起来非常通用:

代码语言:javascript
运行
复制
"host": "ubuntu",
"device": "aosp",

我使用它们的方式如下:

代码语言:javascript
运行
复制
final androidInfo = await deviceInfoPlugin.androidInfo;

if (androidInfo.host == 'ubuntu' && androidInfo.device == 'aosp') {
    print('LD Player Detected!');
}

但是老实说,我害怕这种方法,因为我不想错误地阻止任何用户,所以我在任何时候都使用它们与[消]火基遥控器一起启用/禁用它,但直到现在,我才启用它们,没有任何问题记录。

票数 0
EN

Stack Overflow用户

发布于 2022-06-29 13:31:57

检查这个包设备

代码语言:javascript
运行
复制
bool isRealDevice = await SafeDevice.isRealDevice;

如果运行的设备是仿真器,则此方法返回false。

票数 -2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72802219

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档