将您的应用设置为默认应用以打开特定文件 [英] Make your app a default app to open a certain file

查看:315
本文介绍了将您的应用设置为默认应用以打开特定文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将我的android应用程序设置为打开某些文件类型的默认应用程序?

How do I make my android app the default application to open a certain file type?

我尝试清除默认设置,但该选项显示为灰色,有人知道如何执行此操作吗?

I tried to clear the defaults but the option is greyed out, does anyone know how to do this?

我想使用android中的something.whatever文件打开应用.

I want to make my app open with my something.whatever files in android.

推荐答案

您不能强制执行此操作,也应该不能这样做.您可以做的是让您的应用程序可以打开文件类型.用户将获得标准的您希望使用什么程序"对话框,并且用户可以选择一些默认设置. 如果用户已经选择了默认设置,则他/她需要在对话框出现之前撤消该设置(很明显,否则默认设置"不会产生很大的影响,现在会生效吗?)

You cannot force this, and you shouldn't be able to. What you can do is make known your app can open the filetype. The user gets the standard "what program do you wish to use" dialog, and the user can select something as default. If the user has allready selected a default, he/she needs to undo that before the dialog appears (obviously, otherwise a 'default' wouldn't have a lot of effect, now would it?)

您可以通过添加一个意图过滤器来告诉世界(又名:android)您要打开某种文件类型.基本上,您要做的是将清单放入应用程序中的活动知道如何处理文件类型(或网站/协议等)的清单中.这很容易找到,因此关于同一问题的随机问题是:

You can tell the world (aka: android) that you want to open a certain file type by adding an intent-filter. What you basically do is put in your manifest that an activity in your app knows how to handle the filetype (or website/protocol etc). That's quite easy to find, a random question here on SO about the same issue would be: Android intent filter for a particular file extension?

这篇关于将您的应用设置为默认应用以打开特定文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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