注册成为自定义文件类型的默认应用程序自定义、注册成为、文件类型、应用程序

2023-09-04 09:18:51 作者:触动人心

注册才能够打开自定义类型的文件。说我有.cool文件,如果用户试图oepn它,Android的问他们是否愿意与我的应用程序中打开它。怎么样?

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

推荐答案

我觉得你没有选择。这是由系统处理。当您发送意图同样的事情由地图来处理,如果有天火的情况下,系统会弹出一个窗口时,你可以选择应用程序,并选择是否希望它永远打开这种文件。 当然,除非你的应用程序是唯一一个打开这种文件。

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文件,你需要设置<意向过滤器> 与标记<数据> 和specificy的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.

 
精彩推荐
图片推荐