From 1c6846d46f3a6f629792aa4ecaae980d9c33bfd6 Mon Sep 17 00:00:00 2001 From: Adrian Tiberius Date: Tue, 23 Feb 2016 19:12:18 +0200 Subject: [PATCH] Added geth library Former-commit-id: ac7af91da0ad89aa430db0ef59f4aea9f53ebaf3 --- .gitignore | 2 +- android/app/build.gradle | 1 + android/app/libs/geth.aar.REMOVED.git-id | 1 + .../main/java/com/messenger/MainActivity.java | 16 ++++++++++++++++ android/build.gradle | 3 +++ 5 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 android/app/libs/geth.aar.REMOVED.git-id diff --git a/.gitignore b/.gitignore index 827ab9ef29..ca7c114886 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,7 @@ project.xcworkspace # Android/IJ # .idea -.gradle +.gradle/ local.properties # node.js diff --git a/android/app/build.gradle b/android/app/build.gradle index 1f2cdd82f4..f27de08265 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -123,4 +123,5 @@ dependencies { compile "com.android.support:appcompat-v7:23.0.1" compile "com.facebook.react:react-native:0.20.+" compile project(':react-native-contacts') + compile(name:'geth', ext:'aar') } diff --git a/android/app/libs/geth.aar.REMOVED.git-id b/android/app/libs/geth.aar.REMOVED.git-id new file mode 100644 index 0000000000..e962af0b86 --- /dev/null +++ b/android/app/libs/geth.aar.REMOVED.git-id @@ -0,0 +1 @@ +92fc60479871e92e37acd25456670791277cd377 \ No newline at end of file diff --git a/android/app/src/main/java/com/messenger/MainActivity.java b/android/app/src/main/java/com/messenger/MainActivity.java index 3e84b8ccd9..9190c8df71 100644 --- a/android/app/src/main/java/com/messenger/MainActivity.java +++ b/android/app/src/main/java/com/messenger/MainActivity.java @@ -4,12 +4,28 @@ import com.facebook.react.ReactActivity; import com.facebook.react.ReactPackage; import com.facebook.react.shell.MainReactPackage; import com.rt2zz.reactnativecontacts.ReactNativeContacts; +import android.os.Bundle; +import com.github.ethereum.go_ethereum.cmd.Geth; import java.util.Arrays; import java.util.List; +import java.util.Properties; public class MainActivity extends ReactActivity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + Properties properties = System.getProperties(); + properties.setProperty("http.nonProxyHosts", "localhost|127.0.0.1"); + properties.setProperty("https.nonProxyHosts", "localhost|127.0.0.1"); + new Thread(new Runnable() { + public void run() { + Geth.run("--ipcdisable --nodiscover --rpc --rpcapi \"db,eth,net,web3\" --fast --datadir=" + getFilesDir().getAbsolutePath()); + } + }).start(); + } + /** * Returns the name of the main component registered from JavaScript. * This is used to schedule rendering of the component. diff --git a/android/build.gradle b/android/build.gradle index ccdfc4e3dc..60402fc4df 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -16,5 +16,8 @@ allprojects { repositories { mavenLocal() jcenter() + flatDir { + dirs 'libs' + } } }