ligi ligi - 1 year ago 191
Android Question

permissionsdispatcher and multiple @NeedsPermission's with kotlin

For one permission I can use permissionsdispatcher in java and kotlin - but when it comes to multiple permissions like this:


I get a problem on kotlin - it does not accept more than one parameter there - works fine with java

Answer Source
@NeedsPermission(value = arrayOf(Manifest.permission.BLUETOOTH_ADMIN,Manifest.permission.BLUETOOTH))

In java @NeedsPermission({...}) the curly brackets {...} is just a shorthand for creating an array. In kotlin you must explicitly say that it is an array.