diff --git a/app/build.gradle b/app/build.gradle index f29092c..efd0a33 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -33,8 +33,19 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } + + buildTypes.each { buildType -> + def properties = new Properties(); + if (buildType.isDebuggable()) { + properties.load(new FileInputStream(new File(projectDir.absolutePath + "/staging.properties"))) + } else { + properties.load(new FileInputStream(new File(projectDir.absolutePath + "/production.properties"))) + } + buildType.buildConfigField "String", "FLURRY_KEY", properties['FLURRY_KEY'] + } } + dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { @@ -70,4 +81,5 @@ dependencies { compile project(':img-selector') compile 'com.facebook.stetho:stetho:1.4.1' compile 'com.github.houxg:FlexLayout:1.2' + compile 'com.flurry.android:analytics:6.4.2' } diff --git a/app/production.properties b/app/production.properties new file mode 100644 index 0000000..db81549 --- /dev/null +++ b/app/production.properties @@ -0,0 +1 @@ +FLURRY_KEY="M6HD6WJPT9Y274MG2FSF" diff --git a/app/src/main/java/org/houxg/leanotelite/LeanoteLite.java b/app/src/main/java/org/houxg/leanotelite/LeanoteLite.java index cfbb7eb..0f78164 100644 --- a/app/src/main/java/org/houxg/leanotelite/LeanoteLite.java +++ b/app/src/main/java/org/houxg/leanotelite/LeanoteLite.java @@ -5,6 +5,7 @@ import android.app.Application; import android.content.Context; import com.facebook.stetho.Stetho; +import com.flurry.android.FlurryAgent; import com.raizlabs.android.dbflow.config.FlowConfig; import com.raizlabs.android.dbflow.config.FlowManager; @@ -22,6 +23,9 @@ public class LeanoteLite extends Application { public void onCreate() { super.onCreate(); mContext = this; + new FlurryAgent.Builder() + .withLogEnabled(true) + .build(this, BuildConfig.FLURRY_KEY); EventBus.builder() .logNoSubscriberMessages(false) .sendNoSubscriberEvent(false) diff --git a/app/staging.properties b/app/staging.properties new file mode 100644 index 0000000..898b345 --- /dev/null +++ b/app/staging.properties @@ -0,0 +1 @@ +FLURRY_KEY="XQP2X5N9BCGB7Z5JHS28"