hongyangandroid / mpermissions Goto Github PK
View Code? Open in Web Editor NEWa easy API to use runtime permission for Android M
License: Apache License 2.0
a easy API to use runtime permission for Android M
License: Apache License 2.0
Error:(6, 8) 错误: XxxActivity$$PermissionProxy不是抽象的, 并且未覆盖PermissionProxy中的抽象方法needShowRationale(int)
public class XxxActivity$$PermissionProxy implements PermissionProxy {
@OverRide
public void grant(XxxActivity source , int requestCode) {
switch(requestCode) {case 1:source.requestSdcardSuccess();break;} }
@OverRide
public void denied(XxxActivity source , int requestCode) {
switch(requestCode) {case 1:source.requestSdcardFailed();break;} }
}
public interface PermissionProxy
{
void grant(T source, int requestCode);
void denied(T source, int requestCode);
void rationale(T source, int requestCode);
boolean needShowRationale(int requestCode);
}
鸿神:
这个库少了一种neverAskAgain的情况,有可能用户习惯性的选择不再询问,拒绝(但是他因为太匆忙而选择的,后来后悔这样的选择,但是在打开这个界面点击的时候没有了授权的提示)
这个链接考虑到这种情况
https://github.com/lovedise/PermissionGen
参考链接
http://www.jianshu.com/p/b4a8b3d4f587
如果我同时申请CALL_PHONE
和SEND_SMS
权限,我CALL_PHONE
授权通过,SEND_SMS
拒绝通过,在onRequestPermissionsResult()
,我想根据授权情况,CALL_PHONE
授权通过做一些处理,SEND_SMS
授权失败做另外的处理。查看源码发现MPermissions并没有做这种区分,所有权限通过才回调@PermissionGrant
修饰的方法,像我上面的那种情况,MPermissions并不支持。
private static void requestResult(Object obj, int requestCode, String[] permissions,
int[] grantResults)
{
List<String> deniedPermissions = new ArrayList<>();
for (int i = 0; i < grantResults.length; i++)
{
if (grantResults[i] != PackageManager.PERMISSION_GRANTED)
{
deniedPermissions.add(permissions[i]);
}
}
if (deniedPermissions.size() > 0)
{
doExecuteFail(obj, requestCode);
} else
{
doExecuteSuccess(obj, requestCode);
}
}
private static void doExecuteSuccess(Object activity, int requestCode)
{
findPermissionProxy(activity).grant(activity, requestCode);
}
Error:(115, 0) Gradle DSL method not found: 'apt()'
Possible causes:
SYSTEM_ALERT_WINDOW WRITE_SETTINGS请问这两个权限怎么处理,每次点击授权仍然提示禁止授权
问题描述:
app刚安装好,点击按钮.检查权限.如果有权限则进入图片连选界面(鸿扬大神的高仿微信那个),这个时候可以读取到图片,然后进app的设置详情权限详情界面,看读写存储的权限都是允许的
然后把读写存储权限都禁止,然后重新打开app,点击按钮.依然能进入图片连选activity,提示暂无外部存储,这是怎么回事啊?按理说不应该走授权失败的那个回调吗?还请大神解惑,不胜感激
机型:zuk z2 ,zui 2.0.079
Caused by: java.lang.RuntimeException: can not find Start$$PermissionProxy , something when compiler.
小米4 6.0.1 已经参考#3 issue 的问题 配置无问题
com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/services/javax.annotation.processing.Processor
File1: E:\MJMHCode\building\libs\mpermissions.jar
File2: C:\Users\Administrator.gradle\caches\modules-2\files-2.1\com.jakewharton\butterknife\7.0.1\d5d13ea991eab0252e3710e5df3d6a9d4b21d461\butterknife-7.0.1.jar
报错信息如下:
Gradle 'MPermissions' project refresh failed
Error:Cannot access first() element from an empty List
Gradle 'MPermissions-master' project refresh failed
Error:Cannot access first() element from an empty List
弹出授权窗口,点击同意之后,依然走到失败的回调
在系统应用程序那里看到是成功授权的
手机是索尼Z5 系统版本是6.0.1
请求是在fragment里进行的
请求的代码
if (Build.VERSION.SDK_INT >= 23) {
MPermissions.requestPermissions(About_app.this, 999, Manifest.permission.READ_SMS, Manifest.permission.READ_CONTACTS,Manifest.permission.READ_EXTERNAL_STORAGE);
} else {
smsContent = new SmsContent(new Handler(), getActivity(), binding.bt1);
getActivity().getContentResolver().registerContentObserver(Uri.parse("content://sms/"), true, smsContent);
}
smsContent = new SmsContent(new Handler(), getActivity(), binding.bt1);
getActivity().getContentResolver().registerContentObserver(Uri.parse("content://sms/"), true, smsContent);
}
@OverRide
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
MPermissions.onRequestPermissionsResult(About_app.this, requestCode, permissions, grantResults);
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
} >
@permissiondenied(999)
public void requestSdcardFailed() {
ToastUtil.toast1_center(getActivity(),"请求权限失败");
Log.e("tag", "requestSdcardFailed");
}>@PermissionGrant(999)
public void requestSdcardSuccess() {
ToastUtil.toast1_center(getActivity(),"请求权限成功");
Log.e("tag", "requestSdcardSuccess");
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.netease.nim.uikit.permission.MPermission.executeMethodWithParam(MPermission.java:162)
at com.netease.nim.uikit.permission.MPermission.executeMethod(MPermission.java:153)
at com.netease.nim.uikit.permission.MPermission.doExecuteSuccess(MPermission.java:114)
if (ActivityCompat.shouldShowRequestPermissionRationale(activity,
permission))
{
proxy.rationale(activity, requestCode);
return true;
}
这里是否是当
if (!ActivityCompat.shouldShowRequestPermissionRationale(activity,
permission))
{
proxy.rationale(activity, requestCode);
return true;
}
的时候才去显示? 进入proxy.rationale(activity,requestCode)?
AS3.0 ,AnnotationProcessor XXXX$$PermissionProxy
这种就生成不了文件了,报不能编译的错,使用Apt是可以的;
好吧,找到原因了,依赖不能放在库中,库中就会报错...
关于Annotation Processor部分,表示不怎么看得懂。
大哥指导一下,该咋办呢?
有木有相关的连接?
application中配置android:allowBackup="false"
然后编译的时候报错了:
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : Attribute application@allowBackup value=(false) from AndroidManifest.xml:27:9-36
is also present at [com.zhy:mpermission-api:1.0.0] AndroidManifest.xml:12:9-35 value=(true).
Suggestion: add 'tools:replace="android:allowBackup"' to element at AndroidManifest.xml:25:5-139:19 to override.
最后我在application 中添加了tools:replace="android:allowBackup"'才解决问题。
你的开源库中是否应该把android:allowBackup的值改为false?
小米自带权限管理,6.0以下需要自己判断做适配,6.0以上,用户拒绝后,无法调用失败后的fail方法,但是成功后可以调用succes方法。小米6.0以下用户拒绝权限后,二次进入就只有一个带确定按钮的提示框,无法二次询问权限,小米走的是自己的适配,各位是怎么解决的?
报错:
Error:android-apt plugin is incompatible with the Android Gradle plugin. Please use 'annotationProc
按照你的gradle配置,无法引用com.zhy.m.permission.MPermissions?
新手,用了以后感觉这个框架挺好用的,但是原理看不懂。
我想问requestSdcardFailed()这个函数是怎么样被回调的?能指点一下吗?或者我该看点什么资料?
我下载demo进行测试(小米note pro),在申请权限(读取联系人)我点击拒绝的时候还是不能走到授权失败的方法中去。
java.lang.RuntimeException: can not find FragmentFavorite$$PermissionProxy , something when compiler.
按照sample,不论Activity还是Fragment都一样这个提示。
Error:(27, 0) Could not find method classpath() for arguments [com.neenbedankt.gradle.plugins:android-apt:1.3] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
下载baseActivity中 报错 请大哥帮忙看看 谢谢
@OverRide
public void onRequestPermissionsResult(int requestCode, String[] permissions,
int[] grantResults) {
MPermissions.onRequestPermissionsResult(this, requestCode, permissions, grantResults);
}
public void Permissions2() {
MPermissions.requestPermissions(this, READ_PHONE_STATE, Manifest.permission.READ_PHONE_STATE);
}
@PermissionGrant(READ_PHONE_STATE)
public static void requestCallPhoneSuccess() {
Debug.logDebug("READ_PHONE_STATE成功");
}
@PermissionDenied(READ_PHONE_STATE)
public void requestCallPhoneFailed() {
Debug.logDebug("READ_PHONE_STATE失败");
}
Gradle 'MPermissions-master' project refresh failed
Error:Failed to notify build listener.
无法运行起来
有没有考虑过混淆之后。我发现找不到相关类,增加如下代码依然有问题
-dontwarn com.zhy.m.permission.**
-keep class com.zhy.m.permission.** { ;}
-keep interface com.zhy.m.permission.* { *; }
求助解决,急用
In project's build.gradle, android-apt:1.4' case databing error.
when id updata android-apt:1.8' ,it works OK.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.