Comments (12)
@vipulasri I don't quite understand your issue, can you post some code that reproduces the problem?
from easypermissions.
@samtstern I mean I am asking two different permissions on two different activities or fragments but as soon as first activity asks for a permission only related to that activity (Ex. Send OTP screen asks for READ_SMS) then another permission (i.e WRITE_EXTERNAL_STORAGE) on another activity and that screen is not yet called or displayed. Still, after allowing first READ_SMS permission, it asks for second permission WRITE_EXTERNAL_STORAGE.
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this);
}
Do I have to change onRequestPermissionResult()
method calling super
?
from easypermissions.
@vipulasri so you have two fragments in the same Activity requesting different permissions? Where do you actually call reuestPermissions
?
from easypermissions.
@samtstern No, I have one request permission in a fragment associated with another activity and second request permission in a different activity. I call to request permission in both activities not associated with each other.
from easypermissions.
@vipulasri please show me how you are requesting the SMS permission.
from easypermissions.
@AfterPermissionGranted(RC_READ_SMS_PERM)
public void initiateOtp() {
if (EasyPermissions.hasPermissions(getActivity(), Manifest.permission.READ_SMS)) {
initiateVerification();
} else {
EasyPermissions.requestPermissions(this, getString(R.string.readsms_permission), RC_READ_SMS_PERM, Manifest.permission.READ_SMS);
}
}
from easypermissions.
And where do you request the external storage permission? I need some context with these code snippets, the behavior you're describing is guaranteed to be some strange issue in how your code is set up so only showing me basic code will not get to the root of the problem.
from easypermissions.
I request the external storage permission(if not permitted), whenever the user has to select a picture from the device and upload it. And request external storage permission is implemented in BaseActivity so that I can reuse the feature when needed.
from easypermissions.
Are you re-using the same request code for each (RC_READ_SMS_PERM
)? Try using different request codes in the requestPermissions
and @AfterPermissionGranted
annotations.
from easypermissions.
I am already using different request codes for both permission requests.
from easypermissions.
@vipulasri I am going to need to see more code to debug, there has not been enough information provided in this thread to lead to the source of the problem. If you'd prefer this can be done on StackOverflow.
from easypermissions.
@samtstern I figured out the problem. Problem was I was having external storage permission in my base activity and the activity which was requiring permission for read sms was extending BaseActivity which was creating issue as onRequestPermissionsResult
was calling its super method thus calling base activity onRequestPermissionsResult
.
from easypermissions.
Related Issues (20)
- Android 12: When user grants only coarse location, EasyPermissions incorrectly determines fine location as permanently denied HOT 1
- Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.content.pm.action.REQUEST_PERMISSIONS pkg=com.android.packageinstaller (has extras) }
- onRequestPermissionsResult not called in non-activity class HOT 1
- onRequestPermissionsResult not called if user presses HOME button
- Vtf HOT 1
- onRequestPermissionsResult() deprecated
- @samtstern This may be the same crash, without obfuscation. I got it during a stress test.
- Request: Make easypermissions library target to android api 33 HOT 4
- doc: inconsistent sample code for AfterPermissionGranted annotation
- h
- b
- the t
- java.lang.NullPointerException
- M HOT 1
- 华为Mate30 鸿蒙3.0 弹窗申请权限,拒绝以后无法再次弹出,也无法弹窗提示,小米正常 HOT 1
- AppSettingsDialog 确定和取消的颜色在部分手机上是透明的 HOT 1
- Can you customize this box? I want to write one myself HOT 1
- As
- A
- onActivityResult回调权限成功,但是@AfterPermissionGranted(PERMISSIONS_REQUEST_CODE) public void onPermissionSuccess() {}不调用正常吗 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from easypermissions.