diff --git a/ExampleGame/Assets/HockeyAppUnityAndroid/AndroidManifest.xml b/ExampleGame/Assets/HockeyAppUnityAndroid/AndroidManifest.xml index 1b4d757..562b8b6 100644 --- a/ExampleGame/Assets/HockeyAppUnityAndroid/AndroidManifest.xml +++ b/ExampleGame/Assets/HockeyAppUnityAndroid/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="18" + android:versionName="5.0.1" > + /// The unique identifier for device, not dependent on package or device. + /// + /// The unique identifier for device, not dependent on package or device. + protected String GetDeviceIdentifier () + { + string deviceIdentifier = null; + + #if (UNITY_ANDROID && !UNITY_EDITOR) + AndroidJavaClass jc = new AndroidJavaClass("net.hockeyapp.unity.HockeyUnityPlugin"); + deviceIdentifier = jc.CallStatic("getDeviceIdentifier"); + #endif + + return deviceIdentifier; + } + /// /// Collect all header fields for the custom exception report. /// @@ -271,7 +287,7 @@ protected virtual List GetLogHeaders () { List list = new List (); - #if (UNITY_ANDROID && !UNITY_EDITOR) +#if (UNITY_ANDROID && !UNITY_EDITOR) list.Add("Package: " + packageID); @@ -291,10 +307,13 @@ protected virtual List GetLogHeaders () string model = GetModel(); list.Add("Model: " + model); + string deviceIdentifier = GetDeviceIdentifier(); + list.Add("CrashReporter Key: " + deviceIdentifier); + list.Add("Date: " + DateTime.UtcNow.ToString("ddd MMM dd HH:mm:ss {}zzzz yyyy").Replace("{}", "GMT")); - #endif +#endif - return list; + return list; } /// diff --git a/ExampleGame/Assets/HockeyAppUnityAndroid/HockeySDK-5.0.2.aar b/ExampleGame/Assets/HockeyAppUnityAndroid/HockeySDK-5.0.2.aar deleted file mode 100644 index 48649e3..0000000 Binary files a/ExampleGame/Assets/HockeyAppUnityAndroid/HockeySDK-5.0.2.aar and /dev/null differ diff --git a/ExampleGame/Assets/HockeyAppUnityAndroid/HockeySDK-5.0.4.aar b/ExampleGame/Assets/HockeyAppUnityAndroid/HockeySDK-5.0.4.aar new file mode 100644 index 0000000..efe85d6 Binary files /dev/null and b/ExampleGame/Assets/HockeyAppUnityAndroid/HockeySDK-5.0.4.aar differ diff --git a/ExampleGame/Assets/HockeyAppUnityAndroid/HockeySDK-5.0.2.aar.meta b/ExampleGame/Assets/HockeyAppUnityAndroid/HockeySDK-5.0.4.aar.meta similarity index 100% rename from ExampleGame/Assets/HockeyAppUnityAndroid/HockeySDK-5.0.2.aar.meta rename to ExampleGame/Assets/HockeyAppUnityAndroid/HockeySDK-5.0.4.aar.meta diff --git a/Plugins/HockeyAppUnityAndroid/hockeysdk-unity-5.0.0.aar b/ExampleGame/Assets/HockeyAppUnityAndroid/hockeysdk-unity-5.0.1.aar similarity index 78% rename from Plugins/HockeyAppUnityAndroid/hockeysdk-unity-5.0.0.aar rename to ExampleGame/Assets/HockeyAppUnityAndroid/hockeysdk-unity-5.0.1.aar index fa3e71b..db09971 100644 Binary files a/Plugins/HockeyAppUnityAndroid/hockeysdk-unity-5.0.0.aar and b/ExampleGame/Assets/HockeyAppUnityAndroid/hockeysdk-unity-5.0.1.aar differ diff --git a/ExampleGame/Assets/HockeyAppUnityAndroid/hockeysdk-unity-5.0.0.aar.meta b/ExampleGame/Assets/HockeyAppUnityAndroid/hockeysdk-unity-5.0.1.aar.meta similarity index 100% rename from ExampleGame/Assets/HockeyAppUnityAndroid/hockeysdk-unity-5.0.0.aar.meta rename to ExampleGame/Assets/HockeyAppUnityAndroid/hockeysdk-unity-5.0.1.aar.meta diff --git a/ExampleGame/Assets/TestScene.unity b/ExampleGame/Assets/TestScene.unity index 7e326bc..550d481 100644 Binary files a/ExampleGame/Assets/TestScene.unity and b/ExampleGame/Assets/TestScene.unity differ diff --git a/ExampleGame/ProjectSettings/AudioManager.asset b/ExampleGame/ProjectSettings/AudioManager.asset index 32d64a9..da61125 100644 Binary files a/ExampleGame/ProjectSettings/AudioManager.asset and b/ExampleGame/ProjectSettings/AudioManager.asset differ diff --git a/ExampleGame/ProjectSettings/ClusterInputManager.asset b/ExampleGame/ProjectSettings/ClusterInputManager.asset index 78deb53..e7886b2 100644 Binary files a/ExampleGame/ProjectSettings/ClusterInputManager.asset and b/ExampleGame/ProjectSettings/ClusterInputManager.asset differ diff --git a/ExampleGame/ProjectSettings/DynamicsManager.asset b/ExampleGame/ProjectSettings/DynamicsManager.asset index d3e219a..1931946 100644 Binary files a/ExampleGame/ProjectSettings/DynamicsManager.asset and b/ExampleGame/ProjectSettings/DynamicsManager.asset differ diff --git a/ExampleGame/ProjectSettings/EditorBuildSettings.asset b/ExampleGame/ProjectSettings/EditorBuildSettings.asset index e72d1dd..6dc24f7 100644 Binary files a/ExampleGame/ProjectSettings/EditorBuildSettings.asset and b/ExampleGame/ProjectSettings/EditorBuildSettings.asset differ diff --git a/ExampleGame/ProjectSettings/EditorSettings.asset b/ExampleGame/ProjectSettings/EditorSettings.asset index a8be75b..a49719a 100644 Binary files a/ExampleGame/ProjectSettings/EditorSettings.asset and b/ExampleGame/ProjectSettings/EditorSettings.asset differ diff --git a/ExampleGame/ProjectSettings/GraphicsSettings.asset b/ExampleGame/ProjectSettings/GraphicsSettings.asset index a609453..18fcd0f 100644 Binary files a/ExampleGame/ProjectSettings/GraphicsSettings.asset and b/ExampleGame/ProjectSettings/GraphicsSettings.asset differ diff --git a/ExampleGame/ProjectSettings/InputManager.asset b/ExampleGame/ProjectSettings/InputManager.asset index 05c6525..9e606dc 100644 Binary files a/ExampleGame/ProjectSettings/InputManager.asset and b/ExampleGame/ProjectSettings/InputManager.asset differ diff --git a/ExampleGame/ProjectSettings/NavMeshAreas.asset b/ExampleGame/ProjectSettings/NavMeshAreas.asset index a69113f..6dd520f 100644 Binary files a/ExampleGame/ProjectSettings/NavMeshAreas.asset and b/ExampleGame/ProjectSettings/NavMeshAreas.asset differ diff --git a/ExampleGame/ProjectSettings/NetworkManager.asset b/ExampleGame/ProjectSettings/NetworkManager.asset index 679fc3a..5dc6a83 100644 Binary files a/ExampleGame/ProjectSettings/NetworkManager.asset and b/ExampleGame/ProjectSettings/NetworkManager.asset differ diff --git a/ExampleGame/ProjectSettings/Physics2DSettings.asset b/ExampleGame/ProjectSettings/Physics2DSettings.asset index ab4e04d..e3b2d0b 100644 Binary files a/ExampleGame/ProjectSettings/Physics2DSettings.asset and b/ExampleGame/ProjectSettings/Physics2DSettings.asset differ diff --git a/ExampleGame/ProjectSettings/ProjectSettings.asset b/ExampleGame/ProjectSettings/ProjectSettings.asset index c6f2269..f0a6d0b 100644 Binary files a/ExampleGame/ProjectSettings/ProjectSettings.asset and b/ExampleGame/ProjectSettings/ProjectSettings.asset differ diff --git a/ExampleGame/ProjectSettings/ProjectVersion.txt b/ExampleGame/ProjectSettings/ProjectVersion.txt index e48a9f5..ca1aa05 100644 --- a/ExampleGame/ProjectSettings/ProjectVersion.txt +++ b/ExampleGame/ProjectSettings/ProjectVersion.txt @@ -1 +1 @@ -m_EditorVersion: 5.6.3f1 +m_EditorVersion: 2017.1.0f3 diff --git a/ExampleGame/ProjectSettings/QualitySettings.asset b/ExampleGame/ProjectSettings/QualitySettings.asset index 60bd14c..5dd909d 100644 Binary files a/ExampleGame/ProjectSettings/QualitySettings.asset and b/ExampleGame/ProjectSettings/QualitySettings.asset differ diff --git a/ExampleGame/ProjectSettings/TagManager.asset b/ExampleGame/ProjectSettings/TagManager.asset index 3bdbd24..1c92a78 100644 Binary files a/ExampleGame/ProjectSettings/TagManager.asset and b/ExampleGame/ProjectSettings/TagManager.asset differ diff --git a/ExampleGame/ProjectSettings/TimeManager.asset b/ExampleGame/ProjectSettings/TimeManager.asset index 3d23384..558a017 100644 Binary files a/ExampleGame/ProjectSettings/TimeManager.asset and b/ExampleGame/ProjectSettings/TimeManager.asset differ diff --git a/ExampleGame/ProjectSettings/UnityConnectSettings.asset b/ExampleGame/ProjectSettings/UnityConnectSettings.asset index 2e7e09c..1cc5485 100644 Binary files a/ExampleGame/ProjectSettings/UnityConnectSettings.asset and b/ExampleGame/ProjectSettings/UnityConnectSettings.asset differ diff --git a/HockeyAppUnityPlugin/build.gradle b/HockeyAppUnityPlugin/build.gradle index 8674409..e4467f8 100644 --- a/HockeyAppUnityPlugin/build.gradle +++ b/HockeyAppUnityPlugin/build.gradle @@ -4,7 +4,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.3.3' + classpath 'com.android.tools.build:gradle:3.0.1' } } diff --git a/HockeyAppUnityPlugin/gradle/wrapper/gradle-wrapper.properties b/HockeyAppUnityPlugin/gradle/wrapper/gradle-wrapper.properties index ba5f1ba..9a8ffa6 100644 --- a/HockeyAppUnityPlugin/gradle/wrapper/gradle-wrapper.properties +++ b/HockeyAppUnityPlugin/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Jun 19 18:17:12 PDT 2017 +#Wed Nov 22 12:44:27 MSK 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip diff --git a/HockeyAppUnityPlugin/hockeysdk-unity/build.gradle b/HockeyAppUnityPlugin/hockeysdk-unity/build.gradle index 3891ebb..6261105 100644 --- a/HockeyAppUnityPlugin/hockeysdk-unity/build.gradle +++ b/HockeyAppUnityPlugin/hockeysdk-unity/build.gradle @@ -2,7 +2,6 @@ apply plugin: 'com.android.library' android { compileSdkVersion 26 - buildToolsVersion "26.0.1" defaultConfig { minSdkVersion 15 @@ -25,5 +24,5 @@ repositories { } dependencies { - compile(name:'HockeySDK-5.0.2', ext:'aar') + compile(name:'HockeySDK-5.0.4', ext:'aar') } diff --git a/HockeyAppUnityPlugin/hockeysdk-unity/libs/HockeySDK-5.0.2.aar b/HockeyAppUnityPlugin/hockeysdk-unity/libs/HockeySDK-5.0.2.aar deleted file mode 100644 index 48649e3..0000000 Binary files a/HockeyAppUnityPlugin/hockeysdk-unity/libs/HockeySDK-5.0.2.aar and /dev/null differ diff --git a/HockeyAppUnityPlugin/hockeysdk-unity/libs/HockeySDK-5.0.4.aar b/HockeyAppUnityPlugin/hockeysdk-unity/libs/HockeySDK-5.0.4.aar new file mode 100644 index 0000000..efe85d6 Binary files /dev/null and b/HockeyAppUnityPlugin/hockeysdk-unity/libs/HockeySDK-5.0.4.aar differ diff --git a/HockeyAppUnityPlugin/hockeysdk-unity/src/main/java/net/hockeyapp/unity/HockeyUnityPlugin.java b/HockeyAppUnityPlugin/hockeysdk-unity/src/main/java/net/hockeyapp/unity/HockeyUnityPlugin.java index 3f8db0b..025035a 100644 --- a/HockeyAppUnityPlugin/hockeysdk-unity/src/main/java/net/hockeyapp/unity/HockeyUnityPlugin.java +++ b/HockeyAppUnityPlugin/hockeysdk-unity/src/main/java/net/hockeyapp/unity/HockeyUnityPlugin.java @@ -1,5 +1,7 @@ package net.hockeyapp.unity; +import android.app.Activity; + import net.hockeyapp.android.Constants; import net.hockeyapp.android.CrashManager; import net.hockeyapp.android.CrashManagerListener; @@ -7,265 +9,272 @@ import net.hockeyapp.android.LoginManager; import net.hockeyapp.android.UpdateManager; import net.hockeyapp.android.metrics.MetricsManager; - -import android.annotation.TargetApi; -import android.app.Activity; -import android.os.Build; +import net.hockeyapp.android.utils.HockeyLog; import java.lang.reflect.Method; +import java.util.concurrent.ExecutionException; +@SuppressWarnings({"unused", "WeakerAccess"}) public class HockeyUnityPlugin { - //region CONFIGURE AND START MODULES - //--------------------------------------------------------------------------------------- - /** - * Enables crash reporting, feedback, user metrics, login, and app updates. - * - * @param currentActivity the context needed for starting this manager. - * @param serverURL the URL of the HockeyApp instance. - * @param appID the app identifier of your app. - * @param secret the app secret of your app used for authentication. - * @param loginMode the login mode used for authentication. - * @param updateManagerEnabled if true, the update manager is enabled. - * @param userMetricsEnabled if true, the metrics manager is enabled. - * @param autoSendEnabled if true, crashes will be sent without presenting a confirmation dialog. - */ - @TargetApi(Build.VERSION_CODES.GINGERBREAD) + //region CONFIGURE AND START MODULES + //--------------------------------------------------------------------------------------- - public static void startHockeyAppManager(final Activity currentActivity, final String serverURL, - final String appID, final String secret, final int loginMode, final boolean updateManagerEnabled, final boolean userMetricsEnabled, final boolean autoSendEnabled) { - currentActivity.runOnUiThread(new Runnable() { - @Override - public void run() { - if (updateManagerEnabled) { - registerUpdateManager(currentActivity, serverURL, appID); - } - if (userMetricsEnabled) { - registerMetricsManager(currentActivity, appID); - } - registerCrashManager(currentActivity, serverURL, appID, autoSendEnabled); - registerFeedbackManager(currentActivity, serverURL, appID); - registerLoginManager(currentActivity, serverURL, appID, secret, loginMode); - } - }); - } - - @TargetApi(Build.VERSION_CODES.GINGERBREAD) - /** - * Configures and starts the UpdateManager module. - * - * @param currentActivity the context needed for starting this manager. - * @param serverURL the URL of the HockeyApp instance. - * @param appID the app identifier of your app. - */ - public static void registerUpdateManager(final Activity currentActivity, final String serverURL, final String appID){ - currentActivity.runOnUiThread(new Runnable() { - @Override - public void run() { - UpdateManager.register(currentActivity, serverURL, appID, null, true); - } - }); - } - - @TargetApi(Build.VERSION_CODES.GINGERBREAD) - /** - * Configures and starts the crash reporting module. - * - * @param currentActivity the context needed for starting this manager. - * @param serverURL the URL of the HockeyApp instance. - * @param appID the app identifier of your app. - * @param autoSendEnabled if true, crashes will be sent without presenting a confirmation dialog. - */ - public static void registerCrashManager(final Activity currentActivity, final String serverURL, final String appID, final boolean autoSendEnabled){ - currentActivity.runOnUiThread(new Runnable() { - @Override - public void run() { - CrashManager.register(currentActivity, serverURL, appID, - new CrashManagerListener() { - public boolean shouldAutoUploadCrashes() { - return autoSendEnabled; - } - }); - } - }); - } + /** + * Enables crash reporting, feedback, user metrics, login, and app updates. + * + * @param currentActivity the context needed for starting this manager. + * @param serverURL the URL of the HockeyApp instance. + * @param appID the app identifier of your app. + * @param secret the app secret of your app used for authentication. + * @param loginMode the login mode used for authentication. + * @param updateManagerEnabled if true, the update manager is enabled. + * @param userMetricsEnabled if true, the metrics manager is enabled. + * @param autoSendEnabled if true, crashes will be sent without presenting a confirmation dialog. + */ + public static void startHockeyAppManager(final Activity currentActivity, final String serverURL, + final String appID, final String secret, final int loginMode, + final boolean updateManagerEnabled, final boolean userMetricsEnabled, final boolean autoSendEnabled) { + currentActivity.runOnUiThread(new Runnable() { + @Override + public void run() { + if (updateManagerEnabled) { + registerUpdateManager(currentActivity, serverURL, appID); + } + if (userMetricsEnabled) { + registerMetricsManager(currentActivity, appID); + } + registerCrashManager(currentActivity, serverURL, appID, autoSendEnabled); + registerFeedbackManager(currentActivity, serverURL, appID); + registerLoginManager(currentActivity, serverURL, appID, secret, loginMode); + } + }); + } - @TargetApi(Build.VERSION_CODES.GINGERBREAD) - /** - * Configures the login module. - * - * @param currentActivity the context needed for starting this manager. - * @param serverURL the URL of the HockeyApp instance. - * @param appID the app identifier of your app. - * @param secret the URL of the HockeyApp instance. - * @param loginMode the app identifier of your app. - */ - public static void registerLoginManager(final Activity currentActivity, final String serverURL, final String appID, final String secret, final int loginMode){ + /** + * Configures and starts the UpdateManager module. + * + * @param currentActivity the context needed for starting this manager. + * @param serverURL the URL of the HockeyApp instance. + * @param appID the app identifier of your app. + */ + public static void registerUpdateManager(final Activity currentActivity, final String serverURL, final String appID) { + currentActivity.runOnUiThread(new Runnable() { + @Override + public void run() { + UpdateManager.register(currentActivity, serverURL, appID, null, true); + } + }); + } - currentActivity.runOnUiThread(new Runnable() { - @Override - public void run() { - LoginManager.register(currentActivity, appID, secret, serverURL, loginMode, currentActivity.getClass()); - } - }); - } + /** + * Configures and starts the crash reporting module. + * + * @param currentActivity the context needed for starting this manager. + * @param serverURL the URL of the HockeyApp instance. + * @param appID the app identifier of your app. + * @param autoSendEnabled if true, crashes will be sent without presenting a confirmation dialog. + */ + public static void registerCrashManager(final Activity currentActivity, final String serverURL, + final String appID, final boolean autoSendEnabled) { + currentActivity.runOnUiThread(new Runnable() { + @Override + public void run() { + CrashManager.register(currentActivity, serverURL, appID, + new CrashManagerListener() { + public boolean shouldAutoUploadCrashes() { + return autoSendEnabled; + } + }); + } + }); + } - @TargetApi(Build.VERSION_CODES.GINGERBREAD) - /** - * Starts the login module. - * - * @param currentActivity the context needed for starting this manager. - */ - public static void performAuthentication(final Activity currentActivity){ + /** + * Configures the login module. + * + * @param currentActivity the context needed for starting this manager. + * @param serverURL the URL of the HockeyApp instance. + * @param appID the app identifier of your app. + * @param secret the URL of the HockeyApp instance. + * @param loginMode the app identifier of your app. + */ + public static void registerLoginManager(final Activity currentActivity, final String serverURL, + final String appID, final String secret, final int loginMode) { + currentActivity.runOnUiThread(new Runnable() { + @Override + public void run() { + LoginManager.register(currentActivity, appID, secret, serverURL, loginMode, currentActivity.getClass()); + } + }); + } - currentActivity.runOnUiThread(new Runnable() { - @Override - public void run() { - LoginManager.verifyLogin(currentActivity, currentActivity.getIntent()); - } - }); - } + /** + * Starts the login module. + * + * @param currentActivity the context needed for starting this manager. + */ + public static void performAuthentication(final Activity currentActivity) { + currentActivity.runOnUiThread(new Runnable() { + @Override + public void run() { + LoginManager.verifyLogin(currentActivity, currentActivity.getIntent()); + } + }); + } - @TargetApi(Build.VERSION_CODES.GINGERBREAD) - /** - * Configures and starts the feedback module. - * - * @param currentActivity the context needed for starting this manager. - * @param serverURL the URL of the HockeyApp instance. - * @param appID the app identifier of your app. - */ - public static void registerFeedbackManager(final Activity currentActivity, final String serverURL, final String appID){ - currentActivity.runOnUiThread(new Runnable() { - @Override - public void run() { - FeedbackManager.register(currentActivity, serverURL, appID, null); - } - }); - } + /** + * Configures and starts the feedback module. + * + * @param currentActivity the context needed for starting this manager. + * @param serverURL the URL of the HockeyApp instance. + * @param appID the app identifier of your app. + */ + public static void registerFeedbackManager(final Activity currentActivity, final String serverURL, final String appID) { + currentActivity.runOnUiThread(new Runnable() { + @Override + public void run() { + FeedbackManager.register(currentActivity, serverURL, appID, null); + } + }); + } - @TargetApi(Build.VERSION_CODES.GINGERBREAD) - /** - * Configures and starts the metrics module. - * - * @param currentActivity the context needed for starting this manager. - * @param appID the app identifier of your app. - */ - public static void registerMetricsManager(final Activity currentActivity, final String appID){ - currentActivity.runOnUiThread(new Runnable() { - @Override - public void run() { - MetricsManager.register(currentActivity, currentActivity.getApplication(), appID); + /** + * Configures and starts the metrics module. + * + * @param currentActivity the context needed for starting this manager. + * @param appID the app identifier of your app. + */ + public static void registerMetricsManager(final Activity currentActivity, final String appID) { + currentActivity.runOnUiThread(new Runnable() { + @Override + public void run() { + MetricsManager.register(currentActivity.getApplication(), appID); - // Unity's awake calls after android activity shown. - // We force start session to avoid missing it. - try { - Method getInstance = MetricsManager.class.getDeclaredMethod("getInstance"); - getInstance.setAccessible(true); - MetricsManager instance = (MetricsManager) getInstance.invoke(null); - Method updateSession = MetricsManager.class.getDeclaredMethod("updateSession"); - updateSession.setAccessible(true); - updateSession.invoke(instance); - } catch (Throwable ignored) { - } + // Unity's awake calls after android activity shown. + // We force start session to avoid missing it. + try { + Method getInstance = MetricsManager.class.getDeclaredMethod("getInstance"); + getInstance.setAccessible(true); + MetricsManager instance = (MetricsManager) getInstance.invoke(null); + Method updateSession = MetricsManager.class.getDeclaredMethod("updateSession"); + updateSession.setAccessible(true); + updateSession.invoke(instance); + } catch (Throwable ignored) { + } } }); - } + } - @TargetApi(Build.VERSION_CODES.GINGERBREAD) - /** - * Enables crash reporting, feedback, and app updates. If you don't want to enable all features or if you need more options to configure them, use specific register methods instead. - * - * @param currentActivity the context needed for starting this manager. - * @param serverURL the URL of the HockeyApp instance. - * @param appID the app identifier of your app. - */ - public static void registerAll(final Activity currentActivity, final String serverURL, - final String appID) { + /** + * Enables crash reporting, feedback, and app updates. If you don't want to enable all features + * or if you need more options to configure them, use specific register methods instead. + * + * @param currentActivity the context needed for starting this manager. + * @param serverURL the URL of the HockeyApp instance. + * @param appID the app identifier of your app. + */ + public static void registerAll(final Activity currentActivity, final String serverURL, + final String appID) { + currentActivity.runOnUiThread(new Runnable() { + @Override + public void run() { + registerUpdateManager(currentActivity, serverURL, appID); + registerCrashManager(currentActivity, serverURL, appID, true); + registerFeedbackManager(currentActivity, serverURL, appID); + registerMetricsManager(currentActivity, appID); + } + }); + } + //--------------------------------------------------------------------------------------- + //endregion - currentActivity.runOnUiThread(new Runnable() { - @Override - public void run() { - registerUpdateManager(currentActivity, serverURL, appID); - registerCrashManager(currentActivity, serverURL, appID, true); - registerFeedbackManager(currentActivity, serverURL, appID); - registerMetricsManager(currentActivity, appID); - } - }); - } - //--------------------------------------------------------------------------------------- - //endregion - - //region METADATA - //--------------------------------------------------------------------------------------- + //region METADATA + //--------------------------------------------------------------------------------------- - /** - * @return the version of your app. - */ - public static String getVersionCode() { - return Constants.APP_VERSION; - } + /** + * @return the version of your app. + */ + public static String getVersionCode() { + return Constants.APP_VERSION; + } - /** - * @return the version name of your app - */ - public static String getVersionName() { - return Constants.APP_VERSION_NAME; - } + /** + * @return the version name of your app + */ + public static String getVersionName() { + return Constants.APP_VERSION_NAME; + } - /** - * @return the name of the base HockeyApp SDK. - */ - public static String getSdkName() {return Constants.SDK_NAME; } + /** + * @return the name of the base HockeyApp SDK. + */ + public static String getSdkName() { + return Constants.SDK_NAME; + } - /** - * @return the device's model manufacturer name. - */ - public static String getManufacturer() {return Constants.PHONE_MANUFACTURER; } + /** + * @return the device's model manufacturer name. + */ + public static String getManufacturer() { + return Constants.PHONE_MANUFACTURER; + } /** * @return the device's model name. */ - public static String getModel() {return Constants.PHONE_MODEL; } + public static String getModel() { + return Constants.PHONE_MODEL; + } - //--------------------------------------------------------------------------------------- - //endregion + /** + * @return the unique identifier for device, not dependent on package or device. + */ + public static String getDeviceIdentifier() { + try { + return Constants.getDeviceIdentifier().get(); + } catch (InterruptedException | ExecutionException e) { + HockeyLog.error("Couldn't get device identifier", e); + return null; + } + } - //region FEEDBACK MANAGER - //--------------------------------------------------------------------------------------- + //--------------------------------------------------------------------------------------- + //endregion - /** - * Shows a feedback form. This should be called after {@link HockeyUnityPlugin#registerFeedbackManager(Activity, String, String)}. - * - * @param currentActivity the context needed for starting this manager. - */ - @TargetApi(Build.VERSION_CODES.GINGERBREAD) - public static void startFeedbackForm(final Activity currentActivity) { + //region FEEDBACK MANAGER + //--------------------------------------------------------------------------------------- - currentActivity.runOnUiThread(new Runnable() { - @Override - public void run() { - FeedbackManager.showFeedbackActivity(currentActivity); - } - }); - } - //--------------------------------------------------------------------------------------- - //endregion + /** + * Shows a feedback form. This should be called after {@link HockeyUnityPlugin#registerFeedbackManager(Activity, String, String)}. + * + * @param currentActivity the context needed for starting this manager. + */ + public static void startFeedbackForm(final Activity currentActivity) { + currentActivity.runOnUiThread(new Runnable() { + @Override + public void run() { + FeedbackManager.showFeedbackActivity(currentActivity); + } + }); + } + //--------------------------------------------------------------------------------------- + //endregion - //region UPDATE MANAGER - //--------------------------------------------------------------------------------------- + //region UPDATE MANAGER + //--------------------------------------------------------------------------------------- - /** - * Checks for version update and presents update alert if newer version is available. - * - * @param currentActivity the context needed to show update alert. - * @param serverURL the URL of the HockeyApp instance. - * @param appID the app identifier of your app. - */ - @TargetApi(Build.VERSION_CODES.GINGERBREAD) - public static void checkForUpdate(final Activity currentActivity, final String serverURL, final String appID) { - UpdateManager.unregister(); - registerUpdateManager(currentActivity, serverURL, appID); - } - //--------------------------------------------------------------------------------------- - //endregion + /** + * Checks for version update and presents update alert if newer version is available. + * + * @param currentActivity the context needed to show update alert. + * @param serverURL the URL of the HockeyApp instance. + * @param appID the app identifier of your app. + */ + public static void checkForUpdate(final Activity currentActivity, final String serverURL, final String appID) { + UpdateManager.unregister(); + registerUpdateManager(currentActivity, serverURL, appID); + } + //--------------------------------------------------------------------------------------- + //endregion } diff --git a/Plugins/HockeyAppUnityAndroid/AndroidManifest.xml b/Plugins/HockeyAppUnityAndroid/AndroidManifest.xml index 1b4d757..562b8b6 100644 --- a/Plugins/HockeyAppUnityAndroid/AndroidManifest.xml +++ b/Plugins/HockeyAppUnityAndroid/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="18" + android:versionName="5.0.1" > + /// The unique identifier for device, not dependent on package or device. + /// + /// The unique identifier for device, not dependent on package or device. + protected String GetDeviceIdentifier () + { + string deviceIdentifier = null; + + #if (UNITY_ANDROID && !UNITY_EDITOR) + AndroidJavaClass jc = new AndroidJavaClass("net.hockeyapp.unity.HockeyUnityPlugin"); + deviceIdentifier = jc.CallStatic("getDeviceIdentifier"); + #endif + + return deviceIdentifier; + } + /// /// Collect all header fields for the custom exception report. /// @@ -271,7 +287,7 @@ protected virtual List GetLogHeaders () { List list = new List (); - #if (UNITY_ANDROID && !UNITY_EDITOR) +#if (UNITY_ANDROID && !UNITY_EDITOR) list.Add("Package: " + packageID); @@ -291,10 +307,13 @@ protected virtual List GetLogHeaders () string model = GetModel(); list.Add("Model: " + model); + string deviceIdentifier = GetDeviceIdentifier(); + list.Add("CrashReporter Key: " + deviceIdentifier); + list.Add("Date: " + DateTime.UtcNow.ToString("ddd MMM dd HH:mm:ss {}zzzz yyyy").Replace("{}", "GMT")); - #endif +#endif - return list; + return list; } /// diff --git a/Plugins/HockeyAppUnityAndroid/HockeySDK-5.0.2.aar b/Plugins/HockeyAppUnityAndroid/HockeySDK-5.0.2.aar deleted file mode 100644 index 48649e3..0000000 Binary files a/Plugins/HockeyAppUnityAndroid/HockeySDK-5.0.2.aar and /dev/null differ diff --git a/Plugins/HockeyAppUnityAndroid/HockeySDK-5.0.4.aar b/Plugins/HockeyAppUnityAndroid/HockeySDK-5.0.4.aar new file mode 100644 index 0000000..efe85d6 Binary files /dev/null and b/Plugins/HockeyAppUnityAndroid/HockeySDK-5.0.4.aar differ diff --git a/ExampleGame/Assets/HockeyAppUnityAndroid/hockeysdk-unity-5.0.0.aar b/Plugins/HockeyAppUnityAndroid/hockeysdk-unity-5.0.1.aar similarity index 78% rename from ExampleGame/Assets/HockeyAppUnityAndroid/hockeysdk-unity-5.0.0.aar rename to Plugins/HockeyAppUnityAndroid/hockeysdk-unity-5.0.1.aar index fa3e71b..db09971 100644 Binary files a/ExampleGame/Assets/HockeyAppUnityAndroid/hockeysdk-unity-5.0.0.aar and b/Plugins/HockeyAppUnityAndroid/hockeysdk-unity-5.0.1.aar differ