React-native-firebase: RNFirebaseStorage gives error

Created on 17 Sep 2018  路  6Comments  路  Source: invertase/react-native-firebase

new RNFirebaseStoragePackage(), gives error that call requires permission which may be rejected by user. Code should explicitly check if permission is given on Android Studio.

Most helpful comment

May I know what is the solution to this question?

All 6 comments

Please follow the issue template, and also provide some screenshots/actual errors.
Cheers

@Ehesp The error happens on MainApplication.java, on the line new RNFirebaseStoragePackage().

Here is the full error message

Call requires permission which may be rejected by user: code should explicitly check to see if permission is available (with checkPermission) or explicitly handle a potential SecurityException.

This check scans through your code and libraries and looks at the APIs being used, and checks this against the set of permissions required to access those APIs. If the code using those APIs is called at runtime, then the program will crash. Furthermore, for permissions that are revocable (with targetSdkVersion 23), client code must also be prepared to handle the calls throwing an exception if the user rejects the request for permission at runtime.

Issue id: MissingPermission

I'm having the same issue. Here is my MainApplication.java:

`import android.app.Application;

import com.facebook.react.ReactApplication;
import com.brentvatne.react.ReactVideoPackage;
import io.invertase.firebase.RNFirebasePackage;
import io.invertase.firebase.storage.RNFirebaseStoragePackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;

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

public class MainApplication extends Application implements ReactApplication {

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

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

@Override
protected String getJSMainModuleName() {
  return "index";
}

};`

This gives the new RNFirebaseStoragePackage red underlining with the following message:
schermafbeelding 2018-10-26 om 11 13 27

My app successfully compiles, but immediately gives the React Native red error screen:
screenshot_1540545772

May I know what is the solution to this question?

Can you tell how to add check permissions to it

anyone solved this problem?

Was this page helpful?
0 / 5 - 0 ratings