Comments (8)
Hi @cooliean,
are you shure?
In background the module only works with arrays, if you pass only one perm request I convert to array before pass to the native module:
if(typeof perm == "string") perm = [perm];
The module are designed to work with more than one permissions:
public void requestPermission(**final ReadableArray permsArray**, final int reqCode, final Promise promise)
Don't forget to put in AndroidManifest.xml the same permissions that you need to ask in future in run time.
If this keep didn't work, I will send you a zip sample.
from react-native-android-permissions.
@lucasferreira Thank you for your answer , It Word i was forget to put in AndroidManifest.xml the same permissions that you need to ask in future in run time.
Thanks again.
from react-native-android-permissions.
@cooliean , @lucasferreira can you please provide me the code for passing multiple permissions in the checkPermission and requestPermission function, I have already added the permissions in manifest file.
from react-native-android-permissions.
Just pass an array of permissions:
requestPermission(["android.permission.ACCESS_FINE_LOCATION", "android.permission.CAMERA"]).then((result) => {
console.log("Granted!", result);
// now you can set the listenner to watch the user geo location
}, (result) => {
console.log("Not Granted!");
console.log(result);
});
from react-native-android-permissions.
Thanks @lucasferreira will try and let you know.
One more question I have upgraded RN to 0.34.1 from 0.21 will the component work ? as you mentioned that once RN introduces its own Permissions class this will be deprecated, and I guess RN has introduced in RN 0.35.
from react-native-android-permissions.
My component still working @niranjan-b-prajapati ;)
from react-native-android-permissions.
@lucasferreira Sorry for late reply as was out of town on leave for festival.
I am getting error while checking and requesting for multiple permissions as mentioned in above example.
Following is my code:
onAvatarClick() {
console.log(' on RegistrationScreen onAvatarClick');
checkPermission(["android.permission.CAMERA","android.permission.WRITE_EXTERNAL_STORAGE","android.permission.INTERNET"])
.then((result) => {
console.log("checkPermission CAMERA Already Granted!", result);
this.onloadPhoto();
}, (result) => {
requestPermission(["android.permission.CAMERA","android.permission.WRITE_EXTERNAL_STORAGE","android.permission.INTERNET"])
.then((result) => {
console.log("requestPermission CAMERA Granted!", result);
this.onloadPhoto();
}, (result) => {
console.log("requestPermission CAMERA Not Granted!", result);
});
console.log("checkPermission CAMERA Not Granted!", result);
});
}
Following is the screenshot of the same:
Can you please help me on this?
from react-native-android-permissions.
Sorry for delayed answer, but the checkPermission can check only one permission per time. Array use are only allowed at requestPermission method.
By the way, you could try the native module https://facebook.github.io/react-native/docs/permissionsandroid.html could be useful too.
from react-native-android-permissions.
Related Issues (11)
- Doesn't work when running headless js task HOT 3
- Error RNPermissionModule cannot find symbol Context HOT 4
- compatibility with `react-native-navigation`
- cannot find symbol import androidx.legacy.app.ActivityCompat;
- Configuration with name 'default' not found. HOT 1
- Null pointer exception since getCurrentActivity() can sometimes returns null HOT 1
- requestPermissionIfNeeded HOT 1
- The package does not work with RN 0.29 HOT 1
- Detecting Never Ask Again
- Add deprecation warning in README 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 react-native-android-permissions.