简体   繁体   English

如何在我的应用程序中隐藏其他应用程序?

[英]How to Hide other apps from my app?

I want to hide any application (Telegram, Viber, ...) from my app Android. 我想从我的应用程序Android隐藏任何应用程序(电报,Viber等)。 I want to hide another apps in list installed apps from my app. 我想从我的应用中隐藏已安装列表中的其他应用。 I try with this code. 我尝试使用此代码。 I getting app package name and its activity name using this code: 我使用以下代码获取应用程序包名称及其活动名称:

private void hideapplication() {
final PackageManager pm = getPackageManager();

Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);

List<ResolveInfo> appList = pm.queryIntentActivities(mainIntent, 0);
Collections.sort(appList, new ResolveInfo.DisplayNameComparator(pm));

TextView textview= (TextView)findViewById(R.id.textview);
 ImageView imageview =(ImageView)findViewById(R.id.imageview);

for (ResolveInfo temp: appList) {
    Log.v("my logs", "package and activity name = " + temp.activityInfo.packageName + "    " + temp.activityInfo.name);
}

} }

Use this package name & activity name in below code: 在以下代码中使用此程序包名称和活动名称:

checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    if (buttonView.isChecked()) {
        Toast.makeText(context, "Checked", Toast.LENGTH_SHORT).show();
        ComponentName componentName = new ComponentName(applicationInfo.packageName, applicationInfo.name);
        packageManager.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
    }
}

}); });

But I am getting force close. 但是我越来越近了。 How can I solve this problem? 我怎么解决这个问题? Can you help me? 你能帮助我吗?

I want to hide another apps in list installed apps from my app 我想从我的应用中隐藏已安装列表中的其他应用

Fortunately, this is not possible, except via a custom ROM or probably a rooted device. 幸运的是,这是不可能的,除非通过自定义ROM或可能是有根设备。

You can do something similar to this via Android at Work, but your app would need to be a device owner, which requires that your app be set up as part of first powering on the device. 您可以通过Android at Work来执行类似的操作,但是您的应用必须是设备所有者,这要求您在首次启动设备时设置您的应用。

Use this package name & activity name in below code: 在以下代码中使用此程序包名称和活动名称:

Your app does not have the rights to change the enabled status of components of other apps. 您的应用无权更改其他应用的组件的启用状态。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何防止其他应用停止我的应用的后台服务? - How to Prevent other apps from stopping background service of my app? 如何使我的应用程序接受其他应用程序的搜索意图? - How to make my app accept search intents from other apps? 如何从其他应用程序启动我的 Flutter 应用程序 - How can I Launch My Flutter App from other Apps 如何在我的 Android 应用程序中打开来自其他应用程序的链接 - How can open link from other Apps in my App in Android 如何对我的应用进行编码以从其他应用接收内容 - How to code my app to receive content from other apps 如何以编程方式从我的应用程序中清除其他应用程序数据 - How to clear other apps data from my app programmetically 如何在Android中向其他用户隐藏应用 - how to hide apps from other user in android 我想在我的Android应用程序处于前台时隐藏其他应用程序的所有通知。 这可能吗? 怎么样? - I want to hide all notifications of other apps when my Android app is in foreground. Is this possible? How? 如何从应用程序列表中隐藏我的应用程序中的其他应用程序 - how to hide other application from my application from list of apps android 从我的应用程序和仅我的应用程序启动其他 Android 应用程序 - Launching other Android apps from my app and only my app
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM