注册为自定义文件类型的默认应用程序 [英] Register to be default app for custom file type

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

问题描述

注册才能打开自定义类型的文件.假设我有 .cool 文件,如果用户尝试打开它,Android 会询问他们是否愿意用我的应用程序打开它.怎么样?

Register to be able to open files of custom type. Say i have .cool files, and if the user tries to open it, Android asks if they would like to open it with my application. How?

推荐答案

我认为你不会选择那个.这是由系统处理的.当您发送由地图处理的意图时,同样的事情,例如,如果您有 Skyfire,系统会弹出一个窗口,您可以选择应用程序并选择是否希望它始终打开此类文件.
当然,除非您的应用程序是唯一打开此类文件的应用程序.

I think that you don't choose that. This is handle by the system. Same thing when you send an intent to be handled by a map, If you have skyfire for instance, the system pops up a window an you can choose the application and choose if you want it to always open this kind of file.
Unless of course if your application is the only one to open this kind of file.

编辑
我想如果你想让你的应用程序说嘿,我能够打开这些 .cool 文件",你需要设置 与标签 ; 并指定 mimeType 或 Uri.点击此处了解更多详情.

Edit
I think if you want your app to say "hey I'm able to open these .cool files", you need to set up <intent-filters> with a tag <data> and specificy the mimeType or Uri. Check here for more details.

这篇关于注册为自定义文件类型的默认应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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