本文整理汇总了Java中com.yanzhenjie.permission.PermissionListener类的典型用法代码示例。如果您正苦于以下问题:Java PermissionListener类的具体用法?Java PermissionListener怎么用?Java PermissionListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PermissionListener类属于com.yanzhenjie.permission包,在下文中一共展示了PermissionListener类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: requestSDCard
import com.yanzhenjie.permission.PermissionListener; //导入依赖的package包/类
/**
* 申请SDCard权限
*/
public static void requestSDCard(Context context, PermissionListener listener) {
getRationaleListener(context, context.getString(R.string.permission_tips_title_sdcard));
AndPermission.with(context)
.requestCode(REQUEST_CODE)
.permission(Manifest.permission.WRITE_EXTERNAL_STORAGE)
.callback(listener)
.callback(mRationaleListener)
.start();
}
示例2: requestCamera
import com.yanzhenjie.permission.PermissionListener; //导入依赖的package包/类
/**
* 申请打开相机权限
*/
public static void requestCamera(Context context, PermissionListener listener) {
getRationaleListener(context, context.getString(R.string.permission_tips_title_camera));
AndPermission.with(context)
.requestCode(REQUEST_CODE)
.permission(Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA)
.callback(listener)
.callback(mRationaleListener)
.start();
}
示例3: requestReadPhoneState
import com.yanzhenjie.permission.PermissionListener; //导入依赖的package包/类
/**
* 申请获取手机信息权限
*/
public static void requestReadPhoneState(Context context, PermissionListener listener) {
getRationaleListener(context, context.getString(R.string.permission_tips_title_read_phone_state));
AndPermission.with(context)
.requestCode(REQUEST_CODE)
.permission(Manifest.permission.READ_PHONE_STATE)
.callback(listener)
.callback(mRationaleListener)
.start();
}