简体   繁体   English

可以与其他应用程序交互的Android服务

[英]Android service that can interact with other apps

So I'm building an app that has the ability to run in the background and can potentially interact with other components of the OS. 因此,我正在构建一个能够在后台运行并且可以与操作系统的其他组件进行交互的应用程序。

Let's say you're navigating through your file manager, my app would want to add an additional action to what you can normally do with the file manager. 假设您正在浏览文件管理器,我的应用程序希望对您通常使用文件管理器可以执行的操作添加其他操作。 The same thing can happen when say you're browsing with a browser, you have one additional action you can do. 当说您正在使用浏览器浏览时,您可以执行另一项操作,可能会发生同样的事情。 I've been looking at intentservices and bound services. 我一直在研究intentservices和绑定服务。

Can any body tell me if this is doable? 谁能告诉我这是否可行? Yes? 是? No? 没有? A one line explanation would be great as well. 一句话解释也很好。

This has nothing to do with services. 这与服务无关。 This has everything to do with having an <intent-filter> on an <activity> that identifies what file types you support for various Intent actions, like ACTION_VIEW . 这与在<activity>上具有<intent-filter>有关,该标识可识别您支持各种Intent操作(例如ACTION_VIEW文件类型。 Well-written apps that launch such an Intent will either: 启动此类Intent的编写良好的应用将:

  • use the system chooser, in which case you will appear in the option in that chooser, or 使用系统选择器,在这种情况下,您将出现在该选择器的选项中,或者

  • use PackageManager and queryIntentActivities() to build their own "chooser", and you will appear in its UI 使用PackageManagerqueryIntentActivities()构建自己的“选择器”,您将出现在其UI中

Note, though, that not all apps are well-written. 但是请注意,并非所有应用程序都编写良好。 Some morons will only support a fixed set of apps, and there is nothing you can do about that. 一些白痴只支持一组固定的应用程序,您对此无能为力。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM