安卓检查通话自动录音功能是否开启,并跳转到开启页面

介绍

本文章主要介绍安卓检查通话自动录音功能是否开启,并跳转到相应的开启页面,主要介绍小米,华为、vivo和oppo手机,其他手机暂不做介绍

检查手机自动录音

小米

/**
     * 检查小米手机自动录音功能是否开启,true已开启  false未开启
     *
     * @return
     */
    private boolean checkXiaomiRecord() throws Settings.SettingNotFoundException {
        int key = Settings.System.getInt(mContext.getContentResolver(), "button_auto_record_call");
//            XLog.d(TAG, "Xiaomi key:" + key);
        //0是未开启,1是开启
        return key != 0;
    }

OPPO

/**
     * 检查OPPO手机自动录音功能是否开启,true已开启  false未开启
     *
     * @return
     */
    private boolean checkOppoRecord() throws Settings.SettingNotFoundException {
        int key = Settings.Global.getInt(mContext.getContentResolver(), "oplus_customize_all_call_audio_record");
//        int key = Settings.Global.getInt(mContext.getContentResolver(), "oppo_all_call_audio_record");
//            XLog.d(TAG, "Oppo key:" + key);
        //0代表OPPO自动录音未开启,1代表OPPO自动录音已开启
        return key != 0;
    }

VIVO

/**
     * 检查VIVO自动录音功能是否开启,true已开启  false未开启
     *
     * @return
     */
    private boolean checkVivoRecord() throws Settings.SettingNotFoundException {
        int key = Settings.Global.getInt(mContext.getContentResolver(), "call_record_state_global");
//            XLog.d(TAG, "Vivo key:" + key);
        //0代表VIVO自动录音未开启,1代表VIVO所有通话自动录音已开启,2代表指定号码自动录音
        return key == 1;
    }

华为

/**
     * 检查华为手机自动录音功能是否开启,true已开启  false未开启
     *
     * @return
     */
    private boolean checkHuaweiRecord() throws Settings.SettingNotFoundException {
        int key = Settings.Secure.getInt(mContext.getContentResolver(), "enable_record_auto_key");
//            XLog.d(TAG, "Huawei key:" + key);
        //0代表华为自动录音未开启,1代表华为自动录音已开启
        return key != 0;
    }

跳转页面

小米

/**
     * 跳转到小米开启通话自动录音功能页面
     */
    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);
        mContext.startActivity(intent);
    }

oppo

/**
     * 跳转到OPPO开启通话自动录音功能页面
     */
    private void startOppoRecord() {
        ComponentName componentName = new ComponentName("com.android.phone", "com.android.phone.OplusCallFeaturesSetting");
        Intent intent = new Intent();
        intent.setComponent(componentName);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        mContext.startActivity(intent);
    }

vivo

/**
     * 跳转到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);
        mContext.startActivity(intent);
    }

华为

/**
     * 跳转到华为开启通话自动录音功能页面
     */
    private void startHuaweiRecord() {
        ComponentName componentName = new ComponentName("com.android.phone", "com.android.phone.MSimCallFeaturesSetting");
//        ComponentName componentName = new C

你可能感兴趣的:(安卓原生开发系列,android,通话录音)