List of usage examples for android.telecom PhoneAccount CAPABILITY_VIDEO_CALLING
int CAPABILITY_VIDEO_CALLING
To view the source code for android.telecom PhoneAccount CAPABILITY_VIDEO_CALLING.
Click Source Link
From source file:Main.java
public static boolean isVideoEnabled(Context context) { if (true) {/*from ww w . j av a 2 s .c om*/ return true; } TelecomManager telecommMgr = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE); if (telecommMgr == null) { return false; } List<PhoneAccountHandle> phoneAccountHandles = telecommMgr.getCallCapablePhoneAccounts(); for (PhoneAccountHandle handle : phoneAccountHandles) { final PhoneAccount phoneAccount = telecommMgr.getPhoneAccount(handle); if (hasCapability(phoneAccount, PhoneAccount.CAPABILITY_VIDEO_CALLING)) { return true; } } return false; }
From source file:com.mobileglobe.android.simpledialer.common.CallUtil.java
/** * Determines if video calling is available, and if so whether presence checking is available * as well./*from w ww. j av a 2s. c o m*/ * * Returns a bitmask with {@link #VIDEO_CALLING_ENABLED} to indicate that video calling is * available, and {@link #VIDEO_CALLING_PRESENCE} if presence indication is also available. * * @param context The context * @return A bit-mask describing the current video capabilities. */ @RequiresApi(api = Build.VERSION_CODES.M) public static int getVideoCallingAvailability(Context context) { if (!PermissionsUtil.hasPermission(context, Manifest.permission.READ_PHONE_STATE) || !CompatUtils.isVideoCompatible()) { return VIDEO_CALLING_DISABLED; } TelecomManager telecommMgr = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE); if (telecommMgr == null) { return VIDEO_CALLING_DISABLED; } if (ActivityCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) { // TODO: Consider calling // ActivityCompat#requestPermissions // here to request the missing permissions, and then overriding // public void onRequestPermissionsResult(int requestCode, String[] permissions, // int[] grantResults) // to handle the case where the user grants the permission. See the documentation // for ActivityCompat#requestPermissions for more details. return 0; } List<PhoneAccountHandle> accountHandles = telecommMgr.getCallCapablePhoneAccounts(); for (PhoneAccountHandle accountHandle : accountHandles) { PhoneAccount account = telecommMgr.getPhoneAccount(accountHandle); if (account != null) { if (account.hasCapabilities(PhoneAccount.CAPABILITY_VIDEO_CALLING)) { // Builds prior to N do not have presence support. if (!CompatUtils.isVideoPresenceCompatible()) { return VIDEO_CALLING_ENABLED; } int videoCapabilities = VIDEO_CALLING_ENABLED; if (account .hasCapabilities(PhoneAccountSdkCompat.CAPABILITY_VIDEO_CALLING_RELIES_ON_PRESENCE)) { videoCapabilities |= VIDEO_CALLING_PRESENCE; } return videoCapabilities; } } } return VIDEO_CALLING_DISABLED; }
From source file:com.mobileglobe.android.customdialer.common.CallUtil.java
/** * Determines if video calling is available, and if so whether presence checking is available * as well.//from ww w.j av a 2s . co m * * Returns a bitmask with {@link #VIDEO_CALLING_ENABLED} to indicate that video calling is * available, and {@link #VIDEO_CALLING_PRESENCE} if presence indication is also available. * * @param context The context * @return A bit-mask describing the current video capabilities. */ @RequiresApi(api = Build.VERSION_CODES.M) public static int getVideoCallingAvailability(Context context) { if (!PermissionsUtil.hasPermission(context, android.Manifest.permission.READ_PHONE_STATE) || !CompatUtils.isVideoCompatible()) { return VIDEO_CALLING_DISABLED; } TelecomManager telecommMgr = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE); if (telecommMgr == null) { return VIDEO_CALLING_DISABLED; } if (ActivityCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) { // TODO: Consider calling // ActivityCompat#requestPermissions // here to request the missing permissions, and then overriding // public void onRequestPermissionsResult(int requestCode, String[] permissions, // int[] grantResults) // to handle the case where the user grants the permission. See the documentation // for ActivityCompat#requestPermissions for more details. return 0; } List<PhoneAccountHandle> accountHandles = telecommMgr.getCallCapablePhoneAccounts(); for (PhoneAccountHandle accountHandle : accountHandles) { PhoneAccount account = telecommMgr.getPhoneAccount(accountHandle); if (account != null) { if (account.hasCapabilities(PhoneAccount.CAPABILITY_VIDEO_CALLING)) { // Builds prior to N do not have presence support. if (!CompatUtils.isVideoPresenceCompatible()) { return VIDEO_CALLING_ENABLED; } int videoCapabilities = VIDEO_CALLING_ENABLED; if (account .hasCapabilities(PhoneAccountSdkCompat.CAPABILITY_VIDEO_CALLING_RELIES_ON_PRESENCE)) { videoCapabilities |= VIDEO_CALLING_PRESENCE; } return videoCapabilities; } } } return VIDEO_CALLING_DISABLED; }