Commit e24c827a authored by Matyáš Latner's avatar Matyáš Latner

#16 Flurry analytics for Android project

parent 6f3cdc5c
......@@ -4,10 +4,11 @@
android:versionCode="1"
android:versionName="IDE-BUILD" >
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" />
<uses-sdk android:minSdkVersion="17" android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
......
......@@ -5,7 +5,7 @@ final BUILD_CONFIG_ENCODING = 'UTF-8'
android {
buildToolsVersion "20.0.0"
compileSdkVersion 20
compileSdkVersion 21
packagingOptions {
exclude 'META-INF/NOTICE'
......@@ -15,7 +15,7 @@ android {
defaultConfig {
targetSdkVersion 20
targetSdkVersion 17
versionName tablexiaVersionName
versionCode tablexiaVersionCode
applicationId rootProject.applicationIdRelease
......
......@@ -7,11 +7,14 @@ import android.os.Bundle;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import com.flurry.android.FlurryAgent;
import java.io.File;
import java.io.FileOutputStream;
import cz.nic.tablexia.Tablexia;
import cz.nic.tablexia.TablexiaBuildConfig;
import cz.nic.tablexia.TablexiaSettings;
import cz.nic.tablexia.debug.BuildConfig;
import cz.nic.tablexia.util.Log;
......@@ -26,9 +29,15 @@ public class AndroidLauncher extends AndroidApplication {
super.onCreate(savedInstanceState);
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
initialize(tablexia = new Tablexia(BuildConfig.BUILD_TYPE,
getResources().getConfiguration().locale,
SQL_CONNECTION_TYPE,
savedInstanceState == null), config);
getResources().getConfiguration().locale,
SQL_CONNECTION_TYPE,
savedInstanceState == null), config);
if (TablexiaSettings.getInstance().getBuildType().isBugReport() && TablexiaBuildConfig.FLURRY_KEY != null) {
FlurryAgent.setLogEnabled(false);
FlurryAgent.setVersionName(TablexiaSettings.getInstance().getFullName());
FlurryAgent.init(this, TablexiaBuildConfig.FLURRY_KEY);
}
}
/**
......
......@@ -60,6 +60,8 @@ allprojects {
sqlLiteJdbcVersion = '3.8.10.1'
guavaVersion = '18.0'
jacksonVersion = '2.6.1'
androidSupportV4Version = '22.0.0'
googlePlayServicesVersion = '8.3.+'
}
repositories {
......@@ -309,6 +311,9 @@ project(":android") {
compile "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
compile "net.engio:mbassador:$mbassadorVersion"
compile "org.sqldroid:sqldroid:$sqlDroidVersion"
compile "com.android.support:support-v4:$androidSupportV4Version"
compile "com.google.android.gms:play-services-base:$googlePlayServicesVersion"
compile files('libs/FlurryAnalytics-6.1.0.jar')
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
......@@ -340,23 +345,6 @@ project(":ios") {
}
}
/*
project(":html") {
apply plugin: "gwt"
apply plugin: "war"
dependencies {
compile project(":core")
compile "net.engio:mbassador:$mbassadorVersion"
compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion"
compile "com.badlogicgames.gdx:gdx:$gdxVersion:sources"
compile "com.badlogicgames.gdx:gdx-backend-gwt:$gdxVersion:sources"
compile "net.dermetfan.libgdx-utils:libgdx-utils:$gdxUtilsVersion"
}
}
*/
project(":core") {
apply plugin: "java"
......
......@@ -36,6 +36,7 @@ task writeTablexiaBuildConfig {
"\n" +
" public final static String VERSION_NAME = \"${tablexiaVersionName}\";\n" +
" public final static String ASSETS_CHECKSUM = \"${getMapConvertedToString(rootProject.ext.assetsChecksum)}\";\n" +
" public final static String FLURRY_KEY = ${project.hasProperty('TABLEXIA_FLURRY_KEY') ? "\"$TABLEXIA_FLURRY_KEY\"" : "null"};\n" +
"\n" +
"}", BUILD_CONFIG_FILE_ENCODING)
}
......
......@@ -45,21 +45,23 @@ public class TablexiaSettings {
public enum BuildType {
RELEASE("release", false, false, Log.TablexiaLogLevel.ERROR),
DEBUG("debug", true, true, Log.TablexiaLogLevel.DEBUG),
DEVEL("devel", true, true, Log.TablexiaLogLevel.DEBUG);
RELEASE ("release", false, false, true, Log.TablexiaLogLevel.ERROR),
DEBUG ("debug", true, true, true, Log.TablexiaLogLevel.DEBUG),
DEVEL ("devel", true, true, false, Log.TablexiaLogLevel.DEBUG);
private final static BuildType FALLBACK_VARIANT = BuildType.DEVEL;
private final String key;
private final boolean isDebug;
private boolean showBuildTypeInName;
private boolean bugReport;
private final Log.TablexiaLogLevel logLevel;
BuildType(String key, boolean isDebug, boolean showBuildTypeInName, Log.TablexiaLogLevel logLevel) {
BuildType(String key, boolean isDebug, boolean showBuildTypeInName, boolean bugReport, Log.TablexiaLogLevel logLevel) {
this.key = key;
this.isDebug = isDebug;
this.showBuildTypeInName = showBuildTypeInName;
this.bugReport = bugReport;
this.logLevel = logLevel;
}
......@@ -75,6 +77,10 @@ public class TablexiaSettings {
return isDebug;
}
public boolean isBugReport() {
return bugReport;
}
public Log.TablexiaLogLevel getLogLevel() {
return logLevel;
}
......@@ -138,18 +144,22 @@ public class TablexiaSettings {
//////////////////////////// SETTINGS ACCESS
public String getAppName() {
return getBuildType().getAppName();
public String getFullName() {
return getAppName() + " " + getVersionName();
}
public boolean isDebug() {
return BUILD_TYPE.isDebug();
public String getAppName() {
return getBuildType().getAppName();
}
public String getVersionName() {
return VERSION_NAME;
}
public boolean isDebug() {
return BUILD_TYPE.isDebug();
}
public boolean isShowBoundingBoxes() {
return isDebug() && DEBUG_SHOW_BOUNDING_BOXES;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment