900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > 104.android 简单的检查小米 华为 OPPO VIVO手机系统是否打开通话自动录音功能

104.android 简单的检查小米 华为 OPPO VIVO手机系统是否打开通话自动录音功能

时间:2020-12-27 00:48:38

相关推荐

104.android 简单的检查小米 华为 OPPO VIVO手机系统是否打开通话自动录音功能

1.各手机检查是否开启自动录音代码如下:

/*** 检查小米手机自动录音功能是否开启,true已开启 false未开启** @return*/private boolean checkXiaomiRecord() {try {int key = Settings.System.getInt(RecordApp.context.getContentResolver(), "button_auto_record_call");XLog.d(TAG, "Xiaomi key:" + key);//0是未开启,1是开启return key != 0;} catch (Settings.SettingNotFoundException e) {e.printStackTrace();}return true;}/*** 检查OPPO手机自动录音功能是否开启,true已开启 false未开启** @return*/private boolean checkOppoRecord() {try {int key = android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1 ? Settings.Global.getInt(RecordApp.context.getContentResolver(), "oppo_all_call_audio_record") : 0;XLog.d(TAG, "Oppo key:" + key);//0代表OPPO自动录音未开启,1代表OPPO自动录音已开启return key != 0;} catch (Settings.SettingNotFoundException e) {e.printStackTrace();}return true;}/*** 检查VIVO自动录音功能是否开启,true已开启 false未开启** @return*/private boolean checkVivoRecord() {try {int key = android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1 ? Settings.Global.getInt(RecordApp.context.getContentResolver(), "call_record_state_global") : 0;XLog.d(TAG, "Vivo key:" + key);//0代表VIVO自动录音未开启,1代表VIVO所有通话自动录音已开启,2代表指定号码自动录音return key == 1;} catch (Settings.SettingNotFoundException e) {e.printStackTrace();}return true;}/*** 检查华为手机自动录音功能是否开启,true已开启 false未开启** @return*/private boolean checkHuaweiRecord() {try {int key = Settings.Secure.getInt(RecordApp.context.getContentResolver(), "enable_record_auto_key");XLog.d(TAG, "Huawei key:" + key);//0代表华为自动录音未开启,1代表华为自动录音已开启return key != 0;} catch (Settings.SettingNotFoundException e) {e.printStackTrace();}return true;}

2.各手机跳转到开启自动录音页面如下:

/*** 跳转到VIVO开启通话自动录音功能页面*/private void startVivoRecord() {ComponentName componentName = new ComponentName("com.android.incallui", "com.android.incallui.record.CallRecordSetting");Intent intent = new Intent();intent.setComponent(componentName);intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);RecordApp.context.startActivity(intent);ToastUtil.getInstance().showToast("请打开VIVO通话自动录音功能");}/*** 跳转到小米开启通话自动录音功能页面*/private void startXiaomiRecord() {ComponentName componentName = new ComponentName("com.android.phone", "com.android.phone.settings.CallRecordSetting");Intent intent = new Intent();intent.setComponent(componentName);intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);RecordApp.context.startActivity(intent);ToastUtil.getInstance().showToast("请打开小米通话自动录音功能");}/*** 跳转到华为开启通话自动录音功能页面*/private void startHuaweiRecord() {ComponentName componentName = new ComponentName("com.android.phone", "com.android.phone.MSimCallFeaturesSetting");Intent intent = new Intent();intent.setComponent(componentName);intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);RecordApp.context.startActivity(intent);ToastUtil.getInstance().showToast("请打开华为通话自动录音功能");}/*** 跳转到OPPO开启通话自动录音功能页面*/private void startOppoRecord() {ComponentName componentName = new ComponentName("com.android.phone", "com.android.phone.OppoCallFeaturesSetting");Intent intent = new Intent();intent.setComponent(componentName);intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);RecordApp.context.startActivity(intent);ToastUtil.getInstance().showToast("请打开OPPO通话自动录音功能");}

3.查找对应的key值如下:

//Settings下的 System 、Secure 、Global下的key和value遍历打印查看:

//1.Secureif (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {Cursor cursor = RecordApp.context.getContentResolver().query(Settings.Secure.CONTENT_URI, null, null, null);String[] columnNames = cursor.getColumnNames();StringBuilder builder = new StringBuilder();while (cursor.moveToNext()) {for (String columnName : columnNames) {String string = cursor.getString(cursor.getColumnIndex(columnName));builder.append(columnName).append(":").append(string).append("\n");}}Log.e(TAG, builder.toString());}//2.Globalif (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {Cursor cursor = RecordApp.context.getContentResolver().query(Settings.Global.CONTENT_URI, null, null, null);String[] columnNames = cursor.getColumnNames();StringBuilder builder = new StringBuilder();while (cursor.moveToNext()) {for (String columnName : columnNames) {String string = cursor.getString(cursor.getColumnIndex(columnName));builder.append(columnName).append(":").append(string).append("\n");}}Log.e(TAG, builder.toString());}//3.Systemif (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {Cursor cursor = RecordApp.context.getContentResolver().query(Settings.System.CONTENT_URI, null, null, null);String[] columnNames = cursor.getColumnNames();StringBuilder builder = new StringBuilder();while (cursor.moveToNext()) {for (String columnName : columnNames) {String string = cursor.getString(cursor.getColumnIndex(columnName));builder.append(columnName).append(":").append(string).append("\n");}}Log.e(TAG, builder.toString());}

//---------------------------------------有时间用到魅族手机再更新魅族-------------------------------------------

//----------------------------------------------------------END-------------------------------------------------------------

104.android 简单的检查小米 华为 OPPO VIVO手机系统是否打开通话自动录音功能 跳转通话录音页面 安卓怎么检查开启通话自动录音 安卓开启自动录音

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。