当前位置: 首页>>代码示例>>Java>>正文


Java PermissionCheckUtil类代码示例

本文整理汇总了Java中io.rong.imkit.utilities.PermissionCheckUtil的典型用法代码示例。如果您正苦于以下问题:Java PermissionCheckUtil类的具体用法?Java PermissionCheckUtil怎么用?Java PermissionCheckUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PermissionCheckUtil类属于io.rong.imkit.utilities包,在下文中一共展示了PermissionCheckUtil类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onRequestPermissionsResult

import io.rong.imkit.utilities.PermissionCheckUtil; //导入依赖的package包/类
@TargetApi(23)
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
    switch (requestCode) {
        case REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS:
            if (PermissionCheckUtil.checkPermissions(this, AUDIO_CALL_PERMISSIONS)) {
                if (startForCheckPermissions) {
                    startForCheckPermissions = false;
                    RongCallClient.getInstance().onPermissionGranted();
                } else {
                    initView();
                }
            } else {
                if (startForCheckPermissions) {
                    startForCheckPermissions = false;
                    RongCallClient.getInstance().onPermissionDenied();
                } else {
                    finish();
                }
            }
            break;

        default:
            super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    }
}
 
开发者ID:hushengjun,项目名称:FastAndroid,代码行数:27,代码来源:MultiAudioCallActivity.java

示例2: onActivityResult

import io.rong.imkit.utilities.PermissionCheckUtil; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS) {
        if (PermissionCheckUtil.checkPermissions(this, AUDIO_CALL_PERMISSIONS)) {
            if (startForCheckPermissions) {
                startForCheckPermissions = false;
                RongCallClient.getInstance().onPermissionGranted();
            } else {
                initView();
            }
        } else {
            if (startForCheckPermissions) {
                startForCheckPermissions = false;
                RongCallClient.getInstance().onPermissionDenied();
            } else {
                finish();
            }
        }

    } else {
        if (callSession.getEndTime() != 0) {
            finish();
            return;
        }
        shouldShowFloat = true;
        if (resultCode == RESULT_OK) {
            ArrayList<String> invited = data.getStringArrayListExtra("invited");
            RongCallClient.getInstance().addParticipants(callSession.getCallId(), invited);
        }
    }
}
 
开发者ID:hushengjun,项目名称:FastAndroid,代码行数:33,代码来源:MultiAudioCallActivity.java

示例3: onClick

import io.rong.imkit.utilities.PermissionCheckUtil; //导入依赖的package包/类
@Override
public void onClick(Fragment currentFragment, final RongExtension extension) {
    String[] permissions = {Manifest.permission.RECORD_AUDIO};
    if (!PermissionCheckUtil.requestPermissions(currentFragment, permissions)) {
        return;
    }
    Recognizer recognizerView = new Recognizer(extension.getContext());
    recognizerView.setResultCallBack(new IRecognizedResult() {
        @Override
        public void onResult(String data) {
            Editable editable = extension.getInputEditText().getText();
            String str = editable.toString() + data;
            extension.getInputEditText().setText(str);
            extension.getInputEditText().setSelection(str.length());
        }

        @Override
        public void onClearClick() {
            extension.getInputEditText().setText("");
        }
    });
    extension.addPluginPager(recognizerView);
    recognizerView.startRecognize();
}
 
开发者ID:hushengjun,项目名称:FastAndroid,代码行数:25,代码来源:RecognizePlugin.java

示例4: onClick

import io.rong.imkit.utilities.PermissionCheckUtil; //导入依赖的package包/类
@Override
public void onClick(Fragment currentFragment, final RongExtension extension) {
    String[] permissions = {Manifest.permission.RECORD_AUDIO};
    if (!PermissionCheckUtil.requestPermissions(currentFragment, permissions)) {
        return;
    }
    if (SpeechUtility.getUtility() == null) {
        SpeechUtility.createUtility(extension.getContext().getApplicationContext(), SpeechConstant.APPID + "=581f2927"); //初始化
    }
    recognizerView = new RecognizerView(extension.getContext());
    recognizerView.setResultCallBack(new IRecognizedResult() {
        @Override
        public void onResult(String data) {
            Editable editable = extension.getInputEditText().getText();
            String str = editable.toString() + data;
            extension.getInputEditText().setText(str);
            extension.getInputEditText().setSelection(str.length());
        }

        @Override
        public void onClearClick() {
            extension.getInputEditText().setText("");
        }
    });
    extension.addPluginPager(recognizerView);
}
 
开发者ID:LanguidSheep,项目名称:sealtalk-android-master,代码行数:27,代码来源:RecognizePlugin.java

示例5: onRequestPermissionsResult

import io.rong.imkit.utilities.PermissionCheckUtil; //导入依赖的package包/类
@TargetApi(23)
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
    switch (requestCode) {
        case REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS:
            boolean permissionGranted;
            if (mediaType == RongCallCommon.CallMediaType.AUDIO) {
                permissionGranted = PermissionCheckUtil.checkPermissions(this, AUDIO_CALL_PERMISSIONS);
            } else {
                permissionGranted = PermissionCheckUtil.checkPermissions(this, VIDEO_CALL_PERMISSIONS);

            }
            if (permissionGranted) {
                if (startForCheckPermissions) {
                    startForCheckPermissions = false;
                    RongCallClient.getInstance().onPermissionGranted();
                } else {
                    setupIntent();
                }
            } else {
                if (startForCheckPermissions) {
                    startForCheckPermissions = false;
                    RongCallClient.getInstance().onPermissionDenied();
                } else {
                    finish();
                }
            }
            break;
        default:
            super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    }

}
 
开发者ID:hushengjun,项目名称:FastAndroid,代码行数:34,代码来源:SingleCallActivity.java

示例6: onActivityResult

import io.rong.imkit.utilities.PermissionCheckUtil; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS) {

        String[] permissions;
        if (mediaType == RongCallCommon.CallMediaType.AUDIO) {
            permissions = AUDIO_CALL_PERMISSIONS;
        } else {
            permissions = VIDEO_CALL_PERMISSIONS;
        }
        if (PermissionCheckUtil.checkPermissions(this, permissions)) {
            if (startForCheckPermissions) {
                RongCallClient.getInstance().onPermissionGranted();
            } else {
                setupIntent();
            }
        } else {
            if (startForCheckPermissions) {
                RongCallClient.getInstance().onPermissionDenied();
            } else {
                finish();
            }
        }

    } else {
        super.onActivityResult(requestCode, resultCode, data);
    }
}
 
开发者ID:hushengjun,项目名称:FastAndroid,代码行数:29,代码来源:SingleCallActivity.java

示例7: onActivityResult

import io.rong.imkit.utilities.PermissionCheckUtil; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS) {
        if (PermissionCheckUtil.checkPermissions(this, VIDEO_CALL_PERMISSIONS)) {
            if (startForCheckPermissions) {
                startForCheckPermissions = false;
                RongCallClient.getInstance().onPermissionGranted();
            } else {
                initViews();
                setupIntent();
            }
        } else {
            if (startForCheckPermissions) {
                startForCheckPermissions = false;
                RongCallClient.getInstance().onPermissionDenied();
            } else {
                finish();
            }
        }

    } else {
        if (callSession.getEndTime() != 0) {
            finish();
            return;
        }
        setShouldShowFloat(true);
        if (resultCode == RESULT_OK) {
            ArrayList<String> invited = data.getStringArrayListExtra("invited");
            RongCallClient.getInstance().addParticipants(callSession.getCallId(), invited);
        }
    }
}
 
开发者ID:hushengjun,项目名称:FastAndroid,代码行数:34,代码来源:MultiVideoCallActivity.java

示例8: requestCallPermissions

import io.rong.imkit.utilities.PermissionCheckUtil; //导入依赖的package包/类
@TargetApi(23)
boolean requestCallPermissions(RongCallCommon.CallMediaType type, int requestCode) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M)
        return true;

    String[] permissions;
    if (type.equals(RongCallCommon.CallMediaType.VIDEO)) {
        permissions = new String[]{Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO};
    } else if (type.equals(RongCallCommon.CallMediaType.AUDIO)) {
        permissions = new String[]{Manifest.permission.RECORD_AUDIO};
    } else {
        return true;
    }
    return PermissionCheckUtil.requestPermissions(this, permissions, requestCode);
}
 
开发者ID:hushengjun,项目名称:FastAndroid,代码行数:16,代码来源:BaseCallActivity.java

示例9: onMinimizeClick

import io.rong.imkit.utilities.PermissionCheckUtil; //导入依赖的package包/类
void onMinimizeClick(View view) {
    if (Build.BRAND.toLowerCase().contains("xiaomi")) {
        if (PermissionCheckUtil.canDrawOverlays(this)) {
            finish();
        } else {
            Toast.makeText(this, R.string.rc_voip_float_window_not_allowed, Toast.LENGTH_LONG).show();
        }
    } else {
        finish();
    }
}
 
开发者ID:hushengjun,项目名称:FastAndroid,代码行数:12,代码来源:BaseCallActivity.java

示例10: checkEnvironment

import io.rong.imkit.utilities.PermissionCheckUtil; //导入依赖的package包/类
/**
 * 检查应用音视频授权信息
 * 检查网络连接状态
 * 检查是否在通话中
 *
 * @param context   启动的 activity
 * @param mediaType 启动音视频的媒体类型
 * @return 是否允许启动通话界面
 */
private static boolean checkEnvironment(Context context, CallMediaType mediaType) {
    if (context instanceof Activity) {
        String[] permissions;
        if (mediaType.equals(CallMediaType.CALL_MEDIA_TYPE_AUDIO)) {
            permissions = new String[]{Manifest.permission.RECORD_AUDIO};
        } else {
            permissions = new String[]{Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO};
        }
        if (!PermissionCheckUtil.requestPermissions((Activity) context, permissions)) {
            return false;
        }
    }

    RongCallSession callSession = RongCallClient.getInstance().getCallSession();
    if (callSession != null && callSession.getActiveTime() > 0) {
        Toast.makeText(context,
                callSession.getMediaType() == RongCallCommon.CallMediaType.AUDIO ?
                        context.getResources().getString(R.string.rc_voip_call_audio_start_fail) :
                        context.getResources().getString(R.string.rc_voip_call_video_start_fail),
                Toast.LENGTH_SHORT)
                .show();
        return false;
    }
    if (!RongIMClient.getInstance().getCurrentConnectionStatus().equals(RongIMClient.ConnectionStatusListener.ConnectionStatus.CONNECTED)) {
        Toast.makeText(context, context.getResources().getString(io.rong.callkit.R.string.rc_voip_call_network_error), Toast.LENGTH_SHORT).show();
        return false;
    }
    return true;
}
 
开发者ID:sealtalk,项目名称:sealtalk-android,代码行数:39,代码来源:RongCallKit.java

示例11: onActivityResult

import io.rong.imkit.utilities.PermissionCheckUtil; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS) {
        if (PermissionCheckUtil.checkPermissions(this, VIDEO_CALL_PERMISSIONS)) {
            if (startForCheckPermissions) {
                startForCheckPermissions = false;
                RongCallClient.getInstance().onPermissionGranted();
            } else {
                initViews();
                setupIntent();
            }
        } else {
            if (startForCheckPermissions) {
                startForCheckPermissions = false;
                RongCallClient.getInstance().onPermissionDenied();
            } else {
                finish();
            }
        }

    } else if (requestCode == REQUEST_CODE_ADD_MEMBER) {
        if (callSession.getEndTime() != 0) {
            finish();
            return;
        }
        setShouldShowFloat(true);
        if (resultCode == RESULT_OK) {
            ArrayList<String> invited = data.getStringArrayListExtra("invited");
            RongCallClient.getInstance().addParticipants(callSession.getCallId(), invited);
        }
    }
}
 
开发者ID:sealtalk,项目名称:sealtalk-android,代码行数:34,代码来源:MultiVideoCallActivity.java

示例12: onMinimizeClick

import io.rong.imkit.utilities.PermissionCheckUtil; //导入依赖的package包/类
void onMinimizeClick(View view) {
    if (Build.BRAND.toLowerCase().contains("xiaomi")
            || Build.VERSION.SDK_INT >= 23) {
        if (PermissionCheckUtil.canDrawOverlays(this)) {
            finish();
        } else {
            Toast.makeText(this, R.string.rc_voip_float_window_not_allowed, Toast.LENGTH_LONG).show();
        }
    } else {
        finish();
    }
}
 
开发者ID:sealtalk,项目名称:sealtalk-android,代码行数:13,代码来源:BaseCallActivity.java

示例13: onActivityResult

import io.rong.imkit.utilities.PermissionCheckUtil; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS) {
        if (PermissionCheckUtil.checkPermissions(this, AUDIO_CALL_PERMISSIONS)) {
            if (startForCheckPermissions) {
                startForCheckPermissions = false;
                RongCallClient.getInstance().onPermissionGranted();
            } else {
                initView();
            }
        } else {
            if (startForCheckPermissions) {
                startForCheckPermissions = false;
                RongCallClient.getInstance().onPermissionDenied();
            } else {
                finish();
            }
        }

    } else if (requestCode == REQUEST_CODE_ADD_MEMBER) {
        if (callSession.getEndTime() != 0) {
            finish();
            return;
        }
        shouldShowFloat = true;
        if (resultCode == RESULT_OK) {
            ArrayList<String> invited = data.getStringArrayListExtra("invited");
            RongCallClient.getInstance().addParticipants(callSession.getCallId(), invited);
        }
    }
}
 
开发者ID:sealtalk,项目名称:sealtalk-android,代码行数:33,代码来源:MultiAudioCallActivity.java


注:本文中的io.rong.imkit.utilities.PermissionCheckUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。