以编程方式清除我自己的应用默认设置 [英] clear my own app defaults programmatically

查看:49
本文介绍了以编程方式清除我自己的应用默认设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Android 4.0及更高版本中,是否可以通过编程方式清除自己应用的默认设置?有人可以把我指向正确的方向

Is it possible in android 4.0 and higher to programmatically clear your own app's defaults? can someone point me in the right direction if possible

推荐答案

在任何版本的Android中,您都无法通过编程方式将应用设置为默认操作.

You cannot set your app as the default for an action programmatically in any version of Android.

这是出于安全原因,因为恶意应用可能利用它成为任何用户操作的默认设置,并窃取个人信息或使设备无用等.

This is for security reasons, as a malicious app could exploit this to become the default for any user action, and steal personal information, or render the device useless etc.

最好,在第一次运行时,您可以使用虚拟数据启动选择器意图,并要求用户将您的应用设置为默认应用.

At best, on your first run you could launch a chooser intent with dummy data and ask the user to set your app as the default.

我的错误.我以为您想设置默认值.

My mistake. I thought you wanted to set the defaults.

clearPackagePreferredActivities()< PackageManager 中的/a>将清除特定应用程序的默认设置,无论您传递的是哪个包名称.

clearPackagePreferredActivities() in PackageManager will clear the defaults of a particular app, whichever's package name you pass.

这篇关于以编程方式清除我自己的应用默认设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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