简体   繁体   English

如何在Android中识别可接听来电的默认应用程序?

[英]How to Identify the Default App that Accepts Incoming Phone Calls in Android?

I'm simply trying to find out which app is the default app to handle phone calls on my Android test device. 我只是想找出哪个应用程序是处理我的Android测试设备上的电话的默认应用程序。 Right now, I'm using the following code, this SHOULD work, but always returns null: 现在,我正在使用以下代码,这应该可以工作,但始终返回null:

Intent phoneApp = new Intent(Intent.ACTION_ANSWER);

ResolveInfo app = mPM.resolveActivity(phoneApp, PackageManager.MATCH_DEFAULT_ONLY);

Any ideas? 有任何想法吗? It seems there is no documentation on this for some reason! 出于某种原因,似乎没有任何文档!

You can use queryIntentActivities() on PackageManager to find out all the applications that could handle that intent, but that's the most you can do. 您可以在PackageManager上使用queryIntentActivities()来查找可以处理该意图的所有应用程序,但这是您可以做的最多的事情。

Unfortunately, there is no way to find out the default application that gets called for that implicit intent (aside from calling that implicit intent yourself, and seeing which application gets launched afterwards) 不幸的是,没有办法找到默认应用程序,该默认应用程序需要为该隐式意图调用(除了自己调用该隐式意图,以及查看之后启动了哪个应用程序)

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

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