Skip to content

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

Description

@eard7

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!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions