Comments (5)
I had to do something ugly to get this to work, you can't have the Api 33 and Api < 33 permission in the same annotation or else it won't work:
fun startAddToQueueApiCheck() {
if (sdk33OrHigher) {
startAddToQueue33WithPermissionCheck()
} else {
startAddToQueue32WithPermissionCheck()
}
}
@NeedsPermission(WRITE_EXTERNAL_STORAGE, READ_EXTERNAL_STORAGE)
fun startAddToQueue32() {
startAddToQueue()
}
@NeedsPermission(READ_MEDIA_AUDIO, READ_MEDIA_VIDEO)
fun startAddToQueue33() {
startAddToQueue()
}
fun startAddToQueue() {
//actually do the thing here
}
and then call the startAddToQueueApiCheck() for using it
You have to also separate out the @OnShowRationale and @OnPermissionDenied and @OnNeverAskAgain. For example:
@OnPermissionDenied(READ_MEDIA_AUDIO, READ_MEDIA_VIDEO)
fun showDeniedForMedia() {
..
}
@OnPermissionDenied(WRITE_EXTERNAL_STORAGE, READ_EXTERNAL_STORAGE)
..
}
I don't think the library is well equipped to handle this in an elegant manner.
from permissionsdispatcher.
any update on this issue, how did you resolve it?
from permissionsdispatcher.
https://developer.android.com/training/permissions/requesting
from permissionsdispatcher.
How did you resolve the issue?
from permissionsdispatcher.
I don't think the library is well equipped to handle this in an elegant manner.
That's what happens when requirements change and affected libraries aren't updated. No new update for over 2.5yrs means this project is effectively dead on the latest Android APIs imo.
from permissionsdispatcher.
Related Issues (20)
- [KTX] System settings doesn't show up again, when user select nothing in location permission settings and press back button in Android 11
- Same permission with different callbacks is missing.
- When will you release new version? (Use ContextCompat.checkSelfPermission )
- Doesnโt support Android 12 data access auditing HOT 2
- New one HOT 1
- [ktx] Construct PermissionsRequester from Fragment may cause that callbacks (requiresPermission, onPermissionDenied, etc.) are called after Fragment instance is already dead HOT 4
- [ktx] onNeverAskAgain not called HOT 4
- I don't know why it doesn't work
- Ktx-1.1.4 HOT 1
- miweb
- IllegalArgumentException with annotation after updating to Kotlin 1.6.10 HOT 2
- Back in business!
- Kotlin 1.7 Support HOT 10
- @OnNeverAskAgain called along with @NeedsPermission if we ask permission in onViewCreated() of Fragment
- kotlin 1.8 Modifiers [PRIVATE] are not allowed on Kotlin parameters. Allowed modifiers: [VARARG, NOINLINE, CROSSINLINE] HOT 5
- Is there someone maintaining this repo? Is there any updated fork? HOT 1
- fhun
- Add support for ksp
- `This library is no longer maintained.` 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 permissionsdispatcher.