明确自己的应用程序编程默认值 [英] clear my own app defaults programatically

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

问题描述

是否有可能在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

推荐答案

您不能设置您的应用程序作为默认的Andr​​oid中的任何版本的编程操作。

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.

<一个href=\"http://developer.android.com/reference/android/content/pm/PackageManager.html#clearPackage$p$pferredActivities%28java.lang.String%29\">clearPackage$p$pferredActivities()在软件包管理系统将清除特定应用程序的默认值,你传递任何的包名。

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

这篇关于明确自己的应用程序编程默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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