Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Compatibility issue with react-native-navigation #9

Open
eard7 opened this issue Mar 1, 2017 · 1 comment
Open

[Android] Compatibility issue with react-native-navigation #9

eard7 opened this issue Mar 1, 2017 · 1 comment

Comments

@eard7
Copy link

eard7 commented Mar 1, 2017

Hi, first of all thanks for your plugins, i've been using them in an application i'm developing.
Unfortunately i'm having an issue with the android version (iOS version works very well).

I was trying to implement the react-native-camera and couldn't get the camera open. At first i thought there was a problem with react-native-camera, but after some debugging i got this:

java.lang.IllegalArgumentException: Can only use lower 16 bits for requestCode
  at android.support.v4.app.BaseFragmentActivityGingerbread.checkForValidRequestCode(BaseFragmentActivityGingerbread.java:88)
  at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:856)
  at com.remobile.cordova.CordovaInterface.startActivityForResult(CordovaInterface.java:62)

I'm using a component called react-native-navigation (to implement fully native navigation in the app) and this error appear because you need to do some changes to the android skeleton and your main activity extends a class that extends android.support.v4.app.FragmentActivity (originally the MainActivity extends android.app.Activity). And in FragmentActivity startActivityForResult can't accept requestCode higher than 65535.

I've solved the error by editing CordovaPlugin.java and changing RESULT_STEP to a lower level value. But originally that value is 1000000, is there any reason for that?

Thanks for sharing your hard work!

@wgltony
Copy link

wgltony commented Jan 9, 2018

Same issue. Have to change REQUEST_CODE to a lower level value. Don't know the reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants