I am trying to build a native android application where I don't intend to use WEbview for my frontend. I want to make API call to eWeLink (https://github.com/skydiver/ewelink-api) which is exposed for Javascript. How can I achieve this in android ?
2 Answers
Solutions (from easiest to hardest IMO):
You could use a JS evaluator for Android. See https://stackoverflow.com/a/22418086/9398629. LiquidCore https://github.com/LiquidPlayer/LiquidCore seems to be the standard choice. LiquidCore's readme in GitHub has directions for adding NPM package dependencies.
Use a WebView to execute code from that npm package. Reference the results of your JS API calls in your Java code by doing something similar to this: https://stackoverflow.com/a/20377592/9398629. Using
evaluateJavascript
might be easiest.Re-write the
ewelink-api
npm package in Java.

- 61
- 2
- 5
So i had the same issue, so wrote a java api if you still need it that interfaces with the ewelink platform
you can get it here if you want http://ewelink-api-java.co.zw/

- 732
- 2
- 10
- 27