Coder Social home page Coder Social logo

Comments (8)

lucasferreira avatar lucasferreira commented on June 29, 2024

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.

cooliean avatar cooliean commented on June 29, 2024

@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.

niranjan-b-prajapati avatar niranjan-b-prajapati commented on June 29, 2024

@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.

lucasferreira avatar lucasferreira commented on June 29, 2024

Hi @niranjan-b-prajapati

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.

niranjan-b-prajapati avatar niranjan-b-prajapati commented on June 29, 2024

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.

lucasferreira avatar lucasferreira commented on June 29, 2024

My component still working @niranjan-b-prajapati ;)

from react-native-android-permissions.

niranjan-b-prajapati avatar niranjan-b-prajapati commented on June 29, 2024

@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:

checkpermissions error

Can you please help me on this?

from react-native-android-permissions.

lucasferreira avatar lucasferreira commented on June 29, 2024

HI @niranjan-b-prajapati

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.