code cleaning

This commit is contained in:
Adrian Tiberius 2016-06-16 07:27:58 +03:00
parent 58a9c2935c
commit 3d68e6d48a
2 changed files with 8 additions and 22 deletions

View File

@ -14,7 +14,6 @@ import android.os.Environment;
import java.lang.ref.WeakReference;
import com.facebook.react.common.ApplicationHolder;
import com.github.ethereum.go_ethereum.cmd.Geth;
import java.io.File;
@ -68,8 +67,6 @@ public class GethService extends Service {
protected void onGethStarted() {
Log.d(TAG, "Geth Service started");
isGethStarted = true;
//Log.w("Geth", "adding peer");
//Geth.run("--exec admin.addPeer(\"enode://e2f28126720452aa82f7d3083e49e6b3945502cb94d9750a15e27ee310eed6991618199f878e5fbc7dfa0e20f0af9554b41f491dc8f1dbae8f0f2d37a3a613aa@139.162.13.89:55555\") attach http://localhost:8545");
}
protected void startGeth() {
@ -106,15 +103,6 @@ public class GethService extends Service {
@Override
public void onCreate() {
super.onCreate();
//SoLoader.init(this, /* native exopackage */ false);
/*
try {
ApplicationHolder.getApplication();
}
catch (AssertionError err) {
ApplicationHolder.setApplication(getApplication());
}
*/
System.loadLibrary("gethraw");
System.loadLibrary("geth");
@ -127,7 +115,7 @@ public class GethService extends Service {
@Override
public void onDestroy() {
super.onDestroy();
//stop geth
//TODO: stop geth
isGethStarted = false;
isGethInitialized = false;
Log.d(TAG, "Geth Service stopped !");
@ -142,8 +130,7 @@ public class GethService extends Service {
return false;
}
public static boolean isRunning()
{
public static boolean isRunning() {
return isGethInitialized;
}
}

View File

@ -39,6 +39,8 @@ import io.realm.react.RealmReactPackage;
public class MainActivity extends ReactActivity {
private static final String TAG = "MainActivity";
/**
* Incoming message handler. Calls to its binder are sequential!
*/
@ -57,9 +59,8 @@ public class MainActivity extends ReactActivity {
@Override
public void handleMessage(Message message) {
boolean isClaimed = false;
System.out.println("!!!!!!!!!!!!!! Received Service Message !!!!!!!!!!!!!!");
Log.d(TAG, "!!!!!!!!!!!!!! Received Service Message !!!!!!!!!!!!!!");
super.handleMessage(message);
}
}
@ -67,7 +68,6 @@ public class MainActivity extends ReactActivity {
protected ServiceConnection serviceConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder service) {
// This is called when the connection with the service has been
// established, giving us the object we can use to
// interact with the service. We are communicating with the
@ -79,17 +79,16 @@ public class MainActivity extends ReactActivity {
}
public void onServiceDisconnected(ComponentName className) {
// This is called when the connection with the service has been
// unexpectedly disconnected -- that is, its process crashed.
serviceMessenger = null;
isBound = false;
System.out.println("!!!!!!!!!!!!!! Geth Service Disconnected !!!!!!!!!!!!!!");
Log.d(TAG, "!!!!!!!!!!!!!! Geth Service Disconnected !!!!!!!!!!!!!!");
}
};
protected void onConnected() {
System.out.println("!!!!!!!!!!!!!! Geth Service Connected !!!!!!!!!!!!!!");
Log.d(TAG, "!!!!!!!!!!!!!! Geth Service Connected !!!!!!!!!!!!!!");
}
protected void startStatus() {
@ -145,7 +144,7 @@ public class MainActivity extends ReactActivity {
unbindService(serviceConnection);
}
catch (Throwable t) {
Log.e("MainActivity", "Failed to unbind from the geth service", t);
Log.e(TAG, "Failed to unbind from the geth service", t);
}
}