Created
November 29, 2017 11:42
-
-
Save kaueDM/6c1d749ea286448676259a1d226e0e29 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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