简单的防止虚拟定位(安卓)

简单的防止虚拟定位(安卓)

项目里用到过定位签到的功能,但不免有一些用户投机取巧的作弊,毕竟是我们代码不够严谨,也不怨用户,大神太多,所以我们只能简单的防范一下。

private static boolean isInstallVirtual(Context context) {

Map packageNames = getVirtualPackageNames();

PackageManager packageManager = context.getPackageManager();

List pinfo = packageManager.getInstalledPackages(0);

for (int i = 0; i < pinfo.size(); i++) {

if (packageNames.get(pinfo.get(i).packageName) != null) {

return true;

}

}

return false;

}

以下是一些特定的虚拟定位软件 (如有侵犯隐私请私信联系删除 谢谢)

private static Map getVirtualPackageNames() {

Map packageNames = new HashMap<>();

packageNames.put("com.lerist.fakelocation", "com.lerist.fakelocation");// Fake-location虚拟定位

packageNames.put("top.a1024bytes.mockloc.ca.pro", "top.a1024bytes.mockloc.ca.pro");// 天下任我行

packageNames.put("com.qgwapp.shadowside", "com.qgwapp.shadowside");// 任我行免ROOT

packageNames.put("net.superal", "net.superal");// 超级神行者

packageNames.put("com.deniu.daniu", "com.deniu.daniu");// 大牛

packageNames.put("com.deniu.multi", "com.deniu.multi");// 大牛助手

packageNames.put("com.txy.anywhere", "com.txy.anywhere");// 天下游

packageNames.put("de.robv.android.xposed.installer", "de.robv.android.xposed.installer");// Xposed

packageNames.put("github.tornaco.xposedmoduletest", "github.tornaco.xposedmoduletest");// 应用管理Xposed

return packageNames;

}

if (isInstallVirtual(mContext)) {

AlertDialog.Builder builder = new AlertDialog.Builder(mContext);

builder.setMessage("签到失败,不允许使用虚拟定位软件。为防止信息被窃取,请卸载虚拟定位软件。");

builder.setPositiveButton("我知道了", new DialogInterface.OnClickListener() {

@Override

public void onClick(DialogInterface dialog, int which) {

finish();

}

});

builder.setCancelable(false);

builder.show();

}

相关数据流

提供最全的网吧经典广告语2017-08-22作者:小唐点击: 19,364次
靠谱网站365

提供最全的网吧经典广告语2017-08-22作者:小唐点击: 19,364次

⌚ 07-11 👁️‍🗨️ 2141
辐射4控制台怎么开 控制台开启方法
靠谱网站365

辐射4控制台怎么开 控制台开启方法

⌚ 07-21 👁️‍🗨️ 7203
单日订单一万份!揭秘农集网如何玩转B2B、社区概念!
线上365bet注册

单日订单一万份!揭秘农集网如何玩转B2B、社区概念!

⌚ 07-17 👁️‍🗨️ 4925