简体   繁体   English

在Android中,如何通过编程方式更改特定意图的默认应用程序?

[英]In Android how do I change the default application for a particular intent programmatically?

我正在编写一个具有以下功能的Android应用程序:运行/启动该应用程序时,它应该是一种特定意图的默认意图处理程序,而当该应用程序未运行时,应启动系统的默认应用程序...

Fortunately, this is not possible, for obvious security reasons. 幸运的是,出于明显的安全原因,这是不可能的。

You are welcome to enable and disable the activity that contains your specific <intent-filter> , using PackageManager and queryIntentActivities() . 欢迎您使用PackageManagerqueryIntentActivities()启用和禁用包含特定<intent-filter>的活动。 However, you cannot make it be the default handler. 但是,您不能使其成为默认处理程序。 The user will be presented with a chooser dialog and will be able to make their choice. 将向用户显示一个选择器对话框,并且可以进行选择。

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

相关问题 如何在 Android 中以编程方式禁用特定的意图过滤器? - How to Disable a particular Intent-filter programmatically in Android? 如何更改应用程序的默认存储 - How do I change default storage of application 如何获取ActionBarCompat以显示普通的默认图标(在清单中的application / intent-filter android:icon属性中设置)? - How do I get ActionBarCompat to show the normal default icon (set in the application/intent-filter android:icon attribute in the manifest)? 如何以编程方式更改 android 启动器应用程序? - How can i change android launcher application programmatically? 如何更改android中某个特定View的主题? - How do I change the theme of one particular View in android? 如何更改Android应用程序的主题? - How do I change the theme on an Android application? 如何更改以编程方式在android中插入的textview的值? - How do I change the value of a textview inserted programmatically in android? 如何以编程方式在Android中更改Portable Hotspot的SSID? - How do I change the Portable Hotspot's SSID in Android programmatically? Android - 如何以编程方式更改 ImageButton 的宽度? - Android - How do I change the width of my ImageButton programmatically? 如何在Android 2016中以编程方式更改应用程序图标 - How to change an application icon programmatically in Android, 2016
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM