Skip to content

Commit

Permalink
Fix sasquatch app for project vs jcenter getLastSessionErrorReport calls
Browse files Browse the repository at this point in the history
  • Loading branch information
guperrot committed Jan 18, 2017
1 parent 195d84c commit 4180f41
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -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());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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
Expand All @@ -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<ErrorReport>() {

@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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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<ErrorReport>() {

@Override
public void onResult(@Nullable ErrorReport data) {
if (data != null) {
Log.i(LOG_TAG, "Crashes.getLastSessionCrashReport().getThrowable()=", data.getThrowable());
}
}
});
}
}

0 comments on commit 4180f41

Please sign in to comment.