Skip to content

Instantly share code, notes, and snippets.

@kaueDM
Created November 29, 2017 11:42
Show Gist options
  • Save kaueDM/6c1d749ea286448676259a1d226e0e29 to your computer and use it in GitHub Desktop.
Save kaueDM/6c1d749ea286448676259a1d226e0e29 to your computer and use it in GitHub Desktop.
public class TestModule extends ReactContextBaseJavaModule {
PinpadModule pinpadModule;
//Constructor
public TestModule(ReactApplicationContext reactContext) {
super(reactContext);
Log.d("test___2", "TestModule Constructor");
getCurrentActivity().getApplicationContext();
}
//Module Name
@Override
public String getName() {
return "TestModule";
}
@ReactMethod
public void getDevices (Promise promise) {
pinpadModule = new PinpadModule();
if (pinpadModule.getDevices() == null) {
promise.reject("Empty devices list");
} else {
String json = new Gson().toJson(pinpadModule.getDevices());
promise.resolve(json);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment