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


Java PermissionRequest类代码示例

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


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

示例1: showRationaleForPermission

import permissions.dispatcher.PermissionRequest; //导入依赖的package包/类
/**
 * 向用户解释为什么需要这个权限的方法
 **/
@OnShowRationale({Manifest.permission.CALL_PHONE,   //拨号
        Manifest.permission.PROCESS_OUTGOING_CALLS,
        Manifest.permission.RECORD_AUDIO,   //录音
        Manifest.permission.ACCESS_COARSE_LOCATION,     //定位
        Manifest.permission.ACCESS_FINE_LOCATION,
        Manifest.permission.READ_CONTACTS,      //读取联系人
        Manifest.permission.READ_CALL_LOG,      //读取通话记录
        Manifest.permission.READ_SMS,       //读取短信
        Manifest.permission.SEND_SMS,       //发送短信
        "android.permission.WRITE_SMS",     //写短信
        Manifest.permission.BLUETOOTH,      //蓝牙
        Manifest.permission.BLUETOOTH_ADMIN})
public void showRationaleForPermission(final PermissionRequest request) {
    Log.i("LingJu", "StartUpActivity showRationaleForPermission()");
    new CommonDialog(this, "申请权限", "应用还需要以下权限才能正常运行", "知道了")
            .setOnConfirmListener(new CommonDialog.OnConfirmListener() {
                @Override
                public void onConfirm() {
                    request.proceed();
                }
            })
            .show();
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:27,代码来源:StartUpActivity.java

示例2: showWhy

import permissions.dispatcher.PermissionRequest; //导入依赖的package包/类
@OnShowRationale(Manifest.permission.CALL_PHONE)
//提示用户为何要开启此权限
    void showWhy(final PermissionRequest request) {
        new AlertDialog.Builder(this)
                .setMessage("提示用户为何要开启此权限")
                .setPositiveButton("知道了", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        request.proceed();//再次执行权限请求
                    }
                })
                .show();
    }
 
开发者ID:henrymorgen,项目名称:android-advanced-light,代码行数:14,代码来源:ThirdPartyActivity.java

示例3: showRationaleForPermissionState

import permissions.dispatcher.PermissionRequest; //导入依赖的package包/类
/**
 * 弹出权限同意窗口之前调用的提示窗口
 *
 * @param request
 */
@OnShowRationale({Manifest.permission.BLUETOOTH_ADMIN, Manifest.permission.BLUETOOTH,
        Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION,
        Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE})
void showRationaleForPermissionState(PermissionRequest request) {
    // NOTE: Show a rationale to explain why the permission is needed, e.g. with a dialog.
    // Call proceed() or cancel() on the provided PermissionRequest to continue or abort
    MyAlertDialog.showRationaleDialog(this, R.string.permission_rationale, request);
}
 
开发者ID:Twelvelines,项目名称:AndroidMuseumBleManager,代码行数:14,代码来源:MainActivity.java

示例4: showWhy

import permissions.dispatcher.PermissionRequest; //导入依赖的package包/类
@OnShowRationale(Manifest.permission.CAMERA)
//提示用户为何要开启此权限
void showWhy(final PermissionRequest request)
{
    new AlertDialog.Builder(context).setMessage("添加设备需要摄像头扫描")
            .setPositiveButton("知道了", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    request.proceed();
                }
            }).show();
}
 
开发者ID:dufangyu1990,项目名称:LeCatApp,代码行数:13,代码来源:MyFragment.java

示例5: showWhy

import permissions.dispatcher.PermissionRequest; //导入依赖的package包/类
@OnShowRationale(Manifest.permission.WRITE_EXTERNAL_STORAGE)
    //提示用户为何要开启此权限
void showWhy(final PermissionRequest request)
{
    new AlertDialog.Builder(this).setMessage("下载新版apk需要读写文件权限")
            .setPositiveButton("知道了", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    request.proceed();
                }
            }).show();
}
 
开发者ID:dufangyu1990,项目名称:LeCatApp,代码行数:13,代码来源:SplashActivity.java

示例6: showRationaleForCamera

import permissions.dispatcher.PermissionRequest; //导入依赖的package包/类
@OnShowRationale(Manifest.permission.READ_PHONE_STATE)
void showRationaleForCamera(final PermissionRequest request) {
    new AlertDialog.Builder(this)
        .setMessage("Need READ_PHONE_STATE permission for check with Telephony function")
        .setPositiveButton("Allow", (dialog, button) -> request.proceed())
        .setNegativeButton("Deny", (dialog, button) -> request.cancel())
        .show();
}
 
开发者ID:framgia,项目名称:android-emulator-detector,代码行数:9,代码来源:MainActivity.java

示例7: showRationaleForRecord

import permissions.dispatcher.PermissionRequest; //导入依赖的package包/类
@OnShowRationale(Manifest.permission.RECORD_AUDIO)
void showRationaleForRecord(final PermissionRequest request) {
    new CommonDialog.Builder().setContext(getActivity()).setContentStr(
            getResources().getString(R.string.homefragment_permission_prompt))
            .setOnDialogListener(new CommonDialog.OnDialogClickListener() {
                @Override
                public void doOk() {
                    request.proceed();
                }
            }).setIsShowOne(true).build().show();
}
 
开发者ID:zyl409214686,项目名称:Mp3Cutter,代码行数:12,代码来源:HomeFragment.java

示例8: showRationale

import permissions.dispatcher.PermissionRequest; //导入依赖的package包/类
@OnShowRationale(Manifest.permission.CAMERA)
void showRationale(final PermissionRequest request) {
    new AlertDialog.Builder(this)
            .setMessage("申请相机权限")
            .setPositiveButton("确定", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    //再次执行请求
                    request.proceed();
                }
            })
            .show();
}
 
开发者ID:alidili,项目名称:PermissionDemo,代码行数:14,代码来源:PermissionsDispatcherActivity.java

示例9: showRationaleForPermissionState

import permissions.dispatcher.PermissionRequest; //导入依赖的package包/类
/**
 * 弹出权限同意窗口之前调用的提示窗口
 * @param request
 */
@OnShowRationale({Manifest.permission.BLUETOOTH_ADMIN, Manifest.permission.BLUETOOTH,
        Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION,
        Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE})
void showRationaleForPermissionState(PermissionRequest request) {
    // NOTE: Show a rationale to explain why the permission is needed, e.g. with a dialog.
    // Call proceed() or cancel() on the provided PermissionRequest to continue or abort
    MyAlertDialog.showRationaleDialog(this, R.string.permission_rationale, request);
}
 
开发者ID:haodynasty,项目名称:AndroidBleManager,代码行数:13,代码来源:MainActivity.java

示例10: showRationale

import permissions.dispatcher.PermissionRequest; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@OnShowRationale({Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE})
public void showRationale(PermissionRequest request) {
	new AlertDialog.Builder(this)
			.setMessage(R.string.permission_dialog_access_external_storage_title)
			.setPositiveButton(R.string.permission_dialog_allow, (dialog, button) -> request.proceed())
			.setNegativeButton(R.string.permission_dialog_deny, (dialog, button) -> request.cancel())
			.show();
}
 
开发者ID:Drivemode,项目名称:MediaFacade,代码行数:10,代码来源:MainActivity.java

示例11: onShowRationale

import permissions.dispatcher.PermissionRequest; //导入依赖的package包/类
@OnShowRationale(Manifest.permission.CAMERA)
void onShowRationale(final PermissionRequest request) {
    new AlertDialog.Builder(this)
            .setPositiveButton(R.string.permission_go_request, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(@NonNull DialogInterface dialog, int which) {
                    request.proceed();
                }
            })
            .setCancelable(false)
            .setTitle(R.string.permission_dialog_title)
            .setMessage(R.string.permission_request_camera)
            .show();

}
 
开发者ID:YieldNull,项目名称:Biu,代码行数:16,代码来源:QRCodeScanActivity.java

示例12: onShowRationale

import permissions.dispatcher.PermissionRequest; //导入依赖的package包/类
@OnShowRationale({Manifest.permission.READ_PHONE_STATE, Manifest.permission.WRITE_EXTERNAL_STORAGE})
void onShowRationale(final PermissionRequest request) {
    new AlertDialog.Builder(this)
            .setPositiveButton(R.string.permission_go_request, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(@NonNull DialogInterface dialog, int which) {
                    request.proceed();
                }
            })
            .setCancelable(false)
            .setTitle(R.string.permission_dialog_title)
            .setMessage(R.string.permission_request_necessary)
            .show();

}
 
开发者ID:YieldNull,项目名称:Biu,代码行数:16,代码来源:MainActivity.java

示例13: onShowRationale

import permissions.dispatcher.PermissionRequest; //导入依赖的package包/类
@OnShowRationale(Manifest.permission.WRITE_EXTERNAL_STORAGE)
void onShowRationale(final PermissionRequest request) {
    new AlertDialog.Builder(this)
            .setPositiveButton(R.string.permission_go_request, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(@NonNull DialogInterface dialog, int which) {
                    request.proceed();
                }
            })
            .setCancelable(false)
            .setTitle(R.string.permission_dialog_title)
            .setMessage(R.string.permission_request_storage)
            .show();

}
 
开发者ID:YieldNull,项目名称:Biu,代码行数:16,代码来源:ShareActivity.java

示例14: showRationaleDialog

import permissions.dispatcher.PermissionRequest; //导入依赖的package包/类
private void showRationaleDialog(@StringRes int messageResId, final PermissionRequest request) {
    new AlertDialog.Builder(getContext())
            .setPositiveButton(R.string.map_button_allow, (dialog, which) -> {
                request.proceed();
            })
            .setNegativeButton(R.string.map_button_deny, (dialog, which) -> {
                request.cancel();
            })
            .setCancelable(false)
            .setMessage(messageResId)
            .show();
}
 
开发者ID:konifar,项目名称:droidkaigi2016,代码行数:13,代码来源:MapFragment.java

示例15: showRationaleForGetAccount

import permissions.dispatcher.PermissionRequest; //导入依赖的package包/类
@OnShowRationale(Manifest.permission.GET_ACCOUNTS)
void showRationaleForGetAccount(final PermissionRequest request) {
    new AlertDialog.Builder(this)
            .setMessage(R.string.permission_get_account)
            .setPositiveButton(R.string.button_allow, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    request.proceed();
                }
            })
            .show();
}
 
开发者ID:KazuCocoa,项目名称:DroidTestHelper,代码行数:13,代码来源:MainActivity.java


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