use an InterfaceActivity subclass to setup HockeyApp

This commit is contained in:
Stephen Birarda 2015-01-27 17:27:16 -08:00
parent 4c338a9950
commit 62a8483e3c
3 changed files with 58 additions and 3 deletions

View file

@ -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 "<activity android:name='net.hockeyapp.android.UpdateActivity' />")
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()

View file

@ -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);
}
}

View file

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="HockeyAppID">${HOCKEY_APP_APP_ID}</string>
<string name="HockeyAppID">${HOCKEY_APP_ID}</string>
<bool name="HockeyAppEnabled">${HOCKEY_APP_ENABLED}</bool>
</resources>