本文整理汇总了Java中io.rong.imkit.utilities.PermissionCheckUtil.requestPermissions方法的典型用法代码示例。如果您正苦于以下问题:Java PermissionCheckUtil.requestPermissions方法的具体用法?Java PermissionCheckUtil.requestPermissions怎么用?Java PermissionCheckUtil.requestPermissions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.rong.imkit.utilities.PermissionCheckUtil
的用法示例。
在下文中一共展示了PermissionCheckUtil.requestPermissions方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: 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);
}
示例3: 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);
}
示例4: 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;
}