如何限制APK不在真实设备中安装在Android Emulator/Simulator中? [英] How to restrict an APK not to get installed in Android Emulator/Simulator but in real device?

查看:125
本文介绍了如何限制APK不在真实设备中安装在Android Emulator/Simulator中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

希望您知道可以借助诸如Astro文件管理器之类的应用程序备份并安装在android设备中的应用程序并存储为可安装文件(作为APK文件).同样的apk也可以安装在android模拟器中.因此,其他人有可能轻松挖掘已安装应用程序的文件,例如DB,共享首选项等.

Hope you know that an application which is installed in an android device can be backed up and stored as an installable file(as an APK file) with the help of apps like Astro file manager. The same apk can be installed in the android simulator as well. So there is a chance that other can easily dig into the installed app's files like DB, shared preference, etc..

有什么方法可以只允许在真实设备中安装,而不能在模拟器中安装?

Is there any way to permit installing only in real device and not in simulators???

我知道,如果它是ROOTED设备,我们可以像在模拟器中一样访问应用程序的数据.即使我想知道我们是否可以限制在模拟器中安装apk.

I know that if it is ROOTED device, we can access the app's data same like in the simulator. Even though i would like to know whether we can restrict installing apk in simulators.

预先感谢

推荐答案

使用此功能:

public static boolean isEmulator() {
    return 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")
            || Build.MANUFACTURER.contains("Genymotion")
            || (Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic"))
            || "google_sdk".equals(Build.PRODUCT);
}

为此:

if (isEmulator()) {
   // emulator
} else {
   //not emulator
}

我的推荐:

从github尝试.

易于检测android模拟器

Easy to detect android emulator

  • 在Device Farm中的真实设备上进行了检查( https://aws.amazon.com/device-farm/)
  • BlueStacks
  • Genymotion
  • Android模拟器
  • 安迪46.2.207.0
  • MEmu播放
  • Nox应用程序播放器
  • Koplayer
  • .....
  • Checked on real devices in Device Farm (https://aws.amazon.com/device-farm/)
  • BlueStacks
  • Genymotion
  • Android Emulator
  • Andy 46.2.207.0
  • MEmu play
  • Nox App Player
  • Koplayer
  • .....

如何与示例一起使用:

EmulatorDetector.with(this)
                .setCheckTelephony(true)
                .addPackageName("com.bluestacks")
                .setDebug(true)
                .detect(new EmulatorDetector.OnEmulatorDetectorListener() {
                    @Override
                    public void onResult(boolean isEmulator) {

                    }
                });

这篇关于如何限制APK不在真实设备中安装在Android Emulator/Simulator中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆