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

导读:本篇文章讲解 104.android 简单的检查小米、华为、OPPO、VIVO手机系统是否打开通话自动录音功能,跳转通话录音页面,安卓怎么检查开启通话自动录音,安卓开启自动录音,希望对大家有帮助,欢迎收藏,转发!站点地址:www.bmabk.com

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.Secure
if (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.Global
if (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.System
if (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————————————————————-

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/118290.html

(0)
seven_的头像seven_bm

相关推荐

发表回复

登录后才能评论
极客之音——专业性很强的中文编程技术网站,欢迎收藏到浏览器,订阅我们!