Android video input detection

I want to know how to detect an incoming video call on an Android device? Actually there is a lot of documentation on detecting incoming phone calls, but I could not find any information on detecting incoming videos in android?
I found the source code of Samsung Phone.apk and found this method localConnection.getCall().isVideoCall() or this.mPhone.getForegroundCall().isVideoCall() that detect VideoCall but this method requires importing com.android.internal.telephony.* , and this is not allowed for third-party applications.
I think you need to use reflection to call these classes.
So can you tell me about this?


and excuse me, I don’t speak English very well, but I think you understand me.

+4
source share
3 answers

As @Ankit says, you can use iTelephony in the same way as in AutoAnswer , but you need to add a line to this file (which you must add to your project):

 /** * 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 identify the incoming call, for example, the code that is in the automatic answer, and then do this check to see if this video is.

+2
source

All of your English is good, so don't worry.

Yes, if you think that access to the apis phone allows you to do this, here is an example that uses apis internal telephony directly from the user's application space.

Auto_answer application using internal telephony by reflection

+1
source

Android does not have a built-in system for video calls. Yes, the API is available for accessing cameras, but there is no native application for processing video calls. What video calls do you want to capture? Video calls with Google Hangouts? Skype? Yahoo! Communicator? All of these applications accept video calls, so you need to support them yourself if they offer their own APIs.

-one
source

Source: https://habr.com/ru/post/1500754/


All Articles