diff --git a/gvr-interface/CMakeLists.txt b/gvr-interface/CMakeLists.txt index c496fd4b8d..1f39bee631 100644 --- a/gvr-interface/CMakeLists.txt +++ b/gvr-interface/CMakeLists.txt @@ -31,13 +31,17 @@ file(WRITE "${ANDROID_APK_BUILD_DIR}/project.properties" "android.library.refere list(APPEND IGNORE_COPY_LIBS ${LIBOVR_ANDROID_LIBRARIES}) -if (HOCKEY_APP_APP_ID) +# the presence of a HOCKEY_APP_ID means we are making a beta build +if (HOCKEY_APP_ID) set(HOCKEY_APP_ENABLED true) set(HOCKEY_APP_ACTIVITY "") + set(ANDROID_ACTIVITY_NAME io.highfidelity.gvrinterface.InterfaceBetaActivity) + + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/templates/InterfaceBetaActivity.java.in" "${ANDROID_APK_BUILD_DIR}/src/io/highfidelity/gvrinterface/InterfaceBetaActivity.java") else () set(HOCKEY_APP_ENABLED false) endif () -configure_file("${CMAKE_CURRENT_SOURCE_DIR}/res/values/hockeyapp.xml.in" "${ANDROID_APK_BUILD_DIR}/res/values/hockeyapp.xml") +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/templates/hockeyapp.xml.in" "${ANDROID_APK_BUILD_DIR}/res/values/hockeyapp.xml") qt_create_apk() \ No newline at end of file diff --git a/gvr-interface/templates/InterfaceBetaActivity.java.in b/gvr-interface/templates/InterfaceBetaActivity.java.in new file mode 100644 index 0000000000..6698cfa409 --- /dev/null +++ b/gvr-interface/templates/InterfaceBetaActivity.java.in @@ -0,0 +1,51 @@ +// +// InterfaceBetaActivity.java +// gvr-interface/java +// +// Created by Stephen Birarda on 1/27/15. +// Copyright 2015 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +package io.highfidelity.gvrinterface; + +import android.os.Bundle; +import net.hockeyapp.android.CrashManager; +import net.hockeyapp.android.UpdateManager; + +public class InterfaceBetaActivity extends InterfaceActivity { + + public String _hockeyAppID; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + _hockeyAppID = getString(R.string.HockeyAppID); + + checkForUpdates(); + } + + @Override + protected void onPause() { + super.onPause(); + UpdateManager.unregister(); + } + + @Override + protected void onResume() { + super.onResume(); + checkForCrashes(); + } + + private void checkForCrashes() { + CrashManager.register(this, _hockeyAppID); + } + + private void checkForUpdates() { + // Remove this for store / production builds! + UpdateManager.register(this, _hockeyAppID); + } +} \ No newline at end of file diff --git a/gvr-interface/res/values/hockeyapp.xml.in b/gvr-interface/templates/hockeyapp.xml.in similarity index 67% rename from gvr-interface/res/values/hockeyapp.xml.in rename to gvr-interface/templates/hockeyapp.xml.in index f8ad90be5f..edf2d0a8aa 100644 --- a/gvr-interface/res/values/hockeyapp.xml.in +++ b/gvr-interface/templates/hockeyapp.xml.in @@ -1,5 +1,5 @@ - ${HOCKEY_APP_APP_ID} + ${HOCKEY_APP_ID} ${HOCKEY_APP_ENABLED}