简体   繁体   English

在android中检测传入的视频通话

[英]Detect incoming video call in android

I want to know how to detect an incoming Video call on android device? 我想知道如何在Android设备上检测传入的视频通话? Actually there are lots of documentation on detecting incoming phone calls but I couldn't find any information on detecting incoming native video calls in android? 实际上有很多关于检测来电的文档,但我找不到任何关于在an​​droid中检测传入原生视频通话的信息​​?
I found source code of Samsung Phone.apk and find this method localConnection.getCall().isVideoCall() or this.mPhone.getForegroundCall().isVideoCall() that detect VideoCall but this method needs import com.android.internal.telephony.* and this is not allowed for third party applications. 我找到了Samsung Phone.apk源代码,并找到了这个方法localConnection.getCall().isVideoCall()this.mPhone.getForegroundCall().isVideoCall()来检测VideoCall,但是这个方法需要导入com.android.internal.telephony.*并且第三方应用程序不允许这样做。
I think to call this classes need use reflection. 我想要调用这个类需要使用反射。
So may you let me know on this? 那你可以告诉我这个吗?


and excuse me i cant speak English very well but i think you understand me. 对不起,我说英语不太好,但我想你了解我。

Like @Ankit is saying you can use iTelephony just like in the AutoAnswer code but you have to add a line to this file (that you have to put on your project) : 像@Ankit是说你可以使用iTelephony就像在自动应答代码,但你必须添加一行到这个文件(你必须把你的项目):

/**
 * Return TRUE, if current call is video call
 * First active call has priority
 */
boolean isVideoCall();

and then you can use it like this: 然后你可以像这样使用它:

private Boolean isVideoCall(Context context) {

    Class<?> c;
    try {
        c = Class.forName(manager.getClass().getName());
        Method m = c.getDeclaredMethod("getITelephony");
        m.setAccessible(true);
        telephonyService = (ITelephony) m.invoke(manager);

    return telephonyService.isVideoCall();
    } catch (Exception e) {
        telephonyService = null;
        e.printStackTrace();
return false;
    }
}

Just detect the incoming call like the code that is on auto-answer and then do this check to see if it is video. 只需像自动应答中的代码一样检测来电,然后检查是否为视频。

FIrst of all your english is Good, so dont worry. 你的英语中的第一个是好的,所以不要担心。

Yes if you think accessing telephony apis let you do this, then here is an example which uses internal telephony apis directly from user space applicatoin.. 是的,如果你认为访问电话apis让你这样做,那么这里是一个直接从用户空间应用使用内部电话apis的例子。

Auto_answer app using internalTelephony by reflection 通过反射使用internalTelephony的Auto_answer应用

Android does not have a built in system for video calls. Android没有用于视频通话的内置系统。 Yes, the API's are there to access the cameras, but there's no native app to handle video calls. 是的,API可用于访问摄像头,但没有本机应用程序来处理视频呼叫。 What video calls do you want to capture? 您要捕获哪些视频通话? Video calls using Google Hangouts? 使用Google环聊进行视频通话? Skype? Skype的? Yahoo! 雅虎 Messenger? 信使? All these apps allow for video calls, so you need to support those independently if they offer their own API's. 所有这些应用都允许视频通话,因此如果他们提供自己的API,您需要独立支持这些应用。

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

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