Skip to content

Commit

Permalink
Passing remote logger url with BuildConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
Alain Pimentel committed Apr 5, 2018
1 parent 601477f commit 95abafa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
13 changes: 12 additions & 1 deletion android-wsbridge/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@ android {
versionCode 1
versionName "1.2.4"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
buildConfigField "String", "REMOTE_LOGGER_URL", getRemoteLoggerURL()
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
all {
buildConfigField "String", "REMOTE_LOGGER_URL", "\"your_url_goes_here.com\""
}
}
}

Expand All @@ -51,6 +55,13 @@ dependencies {
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.1'
debugCompile 'com.github.markzhai:blockcanary-android:1.5.0'
releaseCompile 'com.github.markzhai:blockcanary-no-op:1.5.0'
}


/**
*
* @return return the entered value if there is any, if not empty string
*/
def getRemoteLoggerURL() {
def value = project.getProperties().get("remoteLoggerURL")
return value != null ? "\"" + value + "\"" : "\"\""
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.androidnetworking.error.ANError;
import com.androidnetworking.interfaces.OkHttpResponseListener;
import com.crashlytics.android.Crashlytics;
import com.dji.wsbridge.BuildConfig;

import org.json.JSONException;
import org.json.JSONObject;
Expand All @@ -32,7 +33,7 @@ public class DJILogger extends Thread {
public static final int CONNECTION_BRIDGE = 2;
private static final String TAG = "RemoteLogger";
// Add your remote server IP
private static final String REMOTE_LOGGER_URL = "your_url_goes_here.com";
private static final String REMOTE_LOGGER_URL = BuildConfig.REMOTE_LOGGER_URL;
private final static char[] hexArray = "0123456789ABCDEF".toCharArray();
private static DJILogger instance = new DJILogger();
private String serverURL;
Expand Down

0 comments on commit 95abafa

Please sign in to comment.