大家有人用过 easypermissions框架 申请权限吗?(https://github.com/googlesamples/easypermissions)
private void requireSomePermission() { String[] perms = { // 把你想要申请的权限放进这里就行,注意用逗号隔 Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_PHONE_STATE }; if (EasyPermissions.hasPermissions(this, perms)) { // Already have permission, do the thing // ... handler.sendEmptyMessageDelayed(1002, 500); Toast.makeText(this, "Permissions Granted!", Toast.LENGTH_LONG).show(); } else { // Do not have permissions, request them now EasyPermissions.requestPermissions(this, getString(R.string.rationale_phone), num, perms); } }
不知为何,初次安装的时候,允许所需要的权限之后,没有回调。没有发消息(handler.sendEmptyMessageDelayed(1002, 500);
)
然后一直卡在这块
之后每次运行,都会回调,继续运行。
我打断点调试了一下,也不知道跑哪去了。
怎么解决啊?
蒲公英wsg
相关分类