开发者

How can I find out what kinds of actions and URI's a given app package will respond to?

开发者 https://www.devze.com 2023-01-15 12:33 出处:网络
Say I want to ask the Phone app to dial a number, or the Maps app to display a particular location, or the Navigator app to navigate to a particular place, etc....

Say I want to ask the Phone app to dial a number, or the Maps app to display a particular location, or the Navigator app to navigate to a particular place, etc....

Obviously I need to broadcast or send an intent. But what actions/categories/data URI's do I use? What will each app recognize and respond to? This seems like basic information that should be documented somewhere obvious. But so far I haven't been able to find it.

I did find the PackageManager class, which looks like it could tell me everything I might wan开发者_JAVA百科t to know. If I take the time to write a package browser app to query it. Which I quite ready to do, but something so insanely useful must have been written by somebody already. Why can't I find one? Am I looking in the wrong places?

Thanks


For OS operations, most of the Intents you seek are documented on the Intent class (see the Constants table, for the constants prefixed with ACTION_, and particularly those described as "Activity Action"). The Javadocs explain what is required for each of those Intent actions.

For some of Google's apps, the Intents you see are documented in an appendix in the developer guide.

Third party apps should document whatever they consider their public API to be on their own sites.

So, for example, that covers "ask the Phone app to dial a number" (ACTION_DIAL) and "Maps app to display a particular location" (geo: Uri).

It does not cover "Navigator app to navigate to a particular place", because Google wrote that app and decided not to document or support any public API for it. That is Google's decision to make.

0

精彩评论

暂无评论...
验证码 换一张
取 消