diff --git a/apps/sasquatch/src/jcenterDependency/java/com/microsoft/azure/mobile/analytics/mobile/sasquatch/features/GetLastSessionErrorReportFeatureTest.java b/apps/sasquatch/src/jcenterDependency/java/com/microsoft/azure/mobile/analytics/mobile/sasquatch/features/GetLastSessionErrorReportFeatureTest.java new file mode 100644 index 0000000000..f82a804408 --- /dev/null +++ b/apps/sasquatch/src/jcenterDependency/java/com/microsoft/azure/mobile/analytics/mobile/sasquatch/features/GetLastSessionErrorReportFeatureTest.java @@ -0,0 +1,18 @@ +package com.microsoft.azure.mobile.analytics.mobile.sasquatch.features; + +import android.util.Log; + +import com.microsoft.azure.mobile.crashes.Crashes; +import com.microsoft.azure.mobile.crashes.model.ErrorReport; + +import static com.microsoft.azure.mobile.sasquatch.activities.MainActivity.LOG_TAG; + +public class GetLastSessionErrorReportFeatureTest { + + public static void run() { + ErrorReport lastSessionCrashReport = Crashes.getLastSessionCrashReport(); + if (lastSessionCrashReport != null) { + Log.i(LOG_TAG, "Crashes.getLastSessionCrashReport().getThrowable()=", lastSessionCrashReport.getThrowable()); + } + } +} diff --git a/apps/sasquatch/src/main/java/com/microsoft/azure/mobile/sasquatch/activities/MainActivity.java b/apps/sasquatch/src/main/java/com/microsoft/azure/mobile/sasquatch/activities/MainActivity.java index 8e74ba6e86..0aa37f255f 100644 --- a/apps/sasquatch/src/main/java/com/microsoft/azure/mobile/sasquatch/activities/MainActivity.java +++ b/apps/sasquatch/src/main/java/com/microsoft/azure/mobile/sasquatch/activities/MainActivity.java @@ -6,7 +6,6 @@ import android.content.SharedPreferences; import android.os.Bundle; import android.os.StrictMode; -import android.support.annotation.Nullable; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.util.Log; @@ -17,8 +16,8 @@ import android.widget.Toast; import com.microsoft.azure.mobile.MobileCenter; -import com.microsoft.azure.mobile.ResultCallback; import com.microsoft.azure.mobile.analytics.Analytics; +import com.microsoft.azure.mobile.analytics.mobile.sasquatch.features.GetLastSessionErrorReportFeatureTest; import com.microsoft.azure.mobile.crashes.AbstractCrashesListener; import com.microsoft.azure.mobile.crashes.Crashes; import com.microsoft.azure.mobile.crashes.ErrorAttachments; @@ -31,12 +30,10 @@ public class MainActivity extends AppCompatActivity { + public static final String LOG_TAG = "MobileCenterSasquatch"; static final String APP_SECRET = "45d1d9f6-2492-4e68-bd44-7190351eb5f3"; static final String APP_SECRET_KEY = "appSecret"; static final String SERVER_URL_KEY = "serverUrl"; - - private static final String LOG_TAG = "MobileCenterSasquatch"; - static SharedPreferences sSharedPreferences; @Override @@ -56,15 +53,7 @@ protected void onCreate(Bundle savedInstanceState) { MobileCenter.start(getApplication(), getAppSecret(), Analytics.class, Crashes.class); Log.i(LOG_TAG, "Crashes.hasCrashedInLastSession=" + Crashes.hasCrashedInLastSession()); - Crashes.getLastSessionCrashReport(new ResultCallback() { - - @Override - public void onResult(@Nullable ErrorReport data) { - if (data != null) { - Log.i(LOG_TAG, "Crashes.getLastSessionCrashReport().getThrowable()=", data.getThrowable()); - } - } - }); + GetLastSessionErrorReportFeatureTest.run(); ((TextView) findViewById(R.id.package_name)).setText(String.format(getString(R.string.sdk_source_format), getPackageName().substring(getPackageName().lastIndexOf(".") + 1))); TestFeatures.initialize(this); diff --git a/apps/sasquatch/src/projectDependency/java/com/microsoft/azure/mobile/analytics/mobile/sasquatch/features/GetLastSessionErrorReportFeatureTest.java b/apps/sasquatch/src/projectDependency/java/com/microsoft/azure/mobile/analytics/mobile/sasquatch/features/GetLastSessionErrorReportFeatureTest.java new file mode 100644 index 0000000000..ee9f57bcf1 --- /dev/null +++ b/apps/sasquatch/src/projectDependency/java/com/microsoft/azure/mobile/analytics/mobile/sasquatch/features/GetLastSessionErrorReportFeatureTest.java @@ -0,0 +1,25 @@ +package com.microsoft.azure.mobile.analytics.mobile.sasquatch.features; + +import android.support.annotation.Nullable; +import android.util.Log; + +import com.microsoft.azure.mobile.ResultCallback; +import com.microsoft.azure.mobile.crashes.Crashes; +import com.microsoft.azure.mobile.crashes.model.ErrorReport; + +import static com.microsoft.azure.mobile.sasquatch.activities.MainActivity.LOG_TAG; + +public class GetLastSessionErrorReportFeatureTest { + + public static void run() { + Crashes.getLastSessionCrashReport(new ResultCallback() { + + @Override + public void onResult(@Nullable ErrorReport data) { + if (data != null) { + Log.i(LOG_TAG, "Crashes.getLastSessionCrashReport().getThrowable()=", data.getThrowable()); + } + } + }); + } +}