KjellConnelly / react-native-shared-group-preferences

127 stars 58 forks source link

react-native-shared-group-preferences Link for android #14

Closed edgarjosue1 closed 4 years ago

edgarjosue1 commented 4 years ago

Currently in the document shows how to link manually to integrate the library into android, since when making the link with the command:

react-native link react-native-shared-group-preferences

mark error and the link is not made.

edgarjosue1 commented 4 years ago

I solved what was missing on android. It was necessary to add in the 'MainApplication.java' of our project the following lines:

import com.poppop.RNReactNativeSharedGroupPreferences.RNReactNativeSharedGroupPreferencesPackage; // add this line where the other imports are

@Override protected List getPackages() { return Arrays.asList( new RNReactNativeSharedGroupPreferencesPackage() // add this line ); }

with that solve the problem: setItem is not defined

KjellConnelly commented 4 years ago

Hey Edgar, at work now so I can't update readme, but take a look at one of my other modules:

https://github.com/KjellConnelly/react-native-chartboost/blob/master/README.md

Look at the android manual setup: part 1/2. This is basically what you need to do, but substitute for this package instead of the chartboost one. You got half of it correct, but there are a few more steps.

edgarjosue1 commented 4 years ago

Thank you, it is already working correctly.