安全检测公司提示说界面防劫持,提供了以下的示例代码,但我不知道如何在h5+中调用这行代码
请把以下android中的代码,转化为javascript页面中的代码:
@Override
protected void onPause() {
super.onPause();
String topActivityPackage = null;
ActivityManager activityManager = (ActivityManager)
(MyApplication.myContext.getSystemService(android.content.Context.ACTIVITY_SERVICE));
List<ActivityManager.RunningTaskInfo> runningTaskInfos =
activityManager
.getRunningTasks(1);
if (runningTaskInfos != null) {
ComponentName f = runningTaskInfos.get(0).topActivity;
topActivityPackage = f.getPackageName();
if(topActivityPackage.equalsIgnoreCase("自身应用包名")){ AlertDialog.Builder builder = new
AlertDialog.Builder(MainActivity.this); builder.setTitle("警告");
builder.setPositiveButton("检测到窗口被劫持" , null ); builder.show(); }
}
refresh();
}
3***@qq.com
- 发布:2023-11-08 18:09
- 更新:2023-11-27 17:14
- 阅读:244
请问怎么调用安卓原生的界面防劫持的代码呢?
分类:HTML5+
3***@qq.com (作者)
解决了,在dcloud开发平台的uniapp加固中加固一下就解决了。要采用uniapp(腾讯云加固方案)来解决
2023-11-27 17:12