Coder Social home page Coder Social logo

lucasferreira / react-native-android-permissions Goto Github PK

View Code? Open in Web Editor NEW
119.0 119.0 15.0 30 KB

React Native Android Permissions experimental module - Android M (6.0) permissions like to your React Native application

JavaScript 8.81% Java 91.19%

react-native-android-permissions's Issues

requestPermissionIfNeeded

Would you be interested in a if-needed approach that first runs checkPermission and then requestPermission if we don't have it?

requestPermissinonIfNeeded(permissionName)

I don't mind submitting a PR.

compatibility with `react-native-navigation`

If you use this along with react-native-navigation, the onRequestPermissionsResult in MainActivity never get's called. This is because react-native-navigation's NavigationActivity is what get's returned from getCurrentActivity.

How can i request multi permissions

let pers = ['android.permission.ACCESS_FINE_LOCATION','android.permission.CAMERA']
requestPermission(pers).then((result) => {
console.log("Granted!", result);
// now you can set the listenner to watch the user geo location
}, (result) => {
console.log("Not Granted!");
//this.refs.tvTip.text = ";sfadfaf";
console.log(result);
});

is not work

Error RNPermissionModule cannot find symbol Context

I get error when run react-native run-android.

:react-native-android-permissions:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.). /home/joebiz/Desktop/react_native_app/node_modules/react-native-android-permissions/android/src/main/java/com/burnweb/rnpermissions/RNPermissionsModule.java:44: error: cannot find symbol Context context = getReactApplicationContext(); ^ symbol: class Context location: class RNPermissionsModule 1 error :react-native-android-permissions:compileReleaseJavaWithJavac FAILED

cannot find symbol import androidx.legacy.app.ActivityCompat;

App was working fine, I added android.useAndroidX=true in gradle.properties as few android libraries have migrated to androidX

RNPermissionsModule.java:8: error: cannot find symbol
import android.support.v4.app.ActivityCompat;

tried using import androidx.legacy.app.ActivityCompat, its the same error

React native version : 0.48.0

The package does not work with RN 0.29

Hi.

import android.app.Application;
import android.util.Log;

import com.burnweb.rnpermissions.RNPermissionsPackage;

import java.util.Arrays;
import java.util.List;

public class MainApplication extends Application implements ReactApplication {

    private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
        @Override
        protected boolean getUseDeveloperSupport() {
            return BuildConfig.DEBUG;
        }

        @Override
        protected List<ReactPackage> getPackages() {
            return Arrays.<ReactPackage>asList(
                new MainReactPackage(),
                new RNPermissionsPackage()
            );
        }

        @Override
        public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
            RNPermissionsPackage.onRequestPermissionsResult(requestCode, permissions, grantResults); // very important event callback
            super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        }
    };

    @Override
    public ReactNativeHost getReactNativeHost() {
        return mReactNativeHost;
    }
}

I've got some errors with this package in Android Studio on RN 0.29:
error: method does not override or implement a method from a supertype
and
error: cannot find symbol method onRequestPermissionsResult(int,String[],int[])

With RN 0.28 everything works fine.
I think it's because in RN 0.29 there are breaking changes on Android - https://github.com/facebook/react-native/releases/tag/v0.29.0

How to fix my problem?

Configuration with name 'default' not found.

Despite I do exactly what the documentation prescribes, I'm having an error:

$ react-native run-android --stacktrace
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug...

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> Cannot evaluate module RNPermissionsModule : Configuration with name 'default' not found.

What extra should one do to get this issue resolved? Does it look like something generally possible, or is it more likely project-specific?

Add deprecation warning in README

Since RN 0.29 there's an official module (in NativeModules.AndroidPermissions) to request permissions in Android Marshmallow, although it is undocumented.

Will be released soon a new documented lib (facebook/react-native#9292).

This module should still be useful to who is using RN <= 0.28 and can't upgrade.

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.