本文整理汇总了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);
}
}
示例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);
}
}
}
示例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();
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
示例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();
}
}
示例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;
}
示例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);
}
}
}
示例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();
}
}
示例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);
}
}
}