MonoTouch and MonoDroid crash reports

I am writing a cross-platform application using Mvvmcross, Mono for Android and MonoTouch. In the Java Android application, I port, I used ACRA to provide crash reports and special reports. These reports were sent to our server via an HTTP message.

Are there any crash reporting plugins for Mvvmcross? Can the Mono * community recommend crash reporting libraries?

If there is nothing, how do other developers deal with this? How do they capture application exceptions and android ANRs so that you can release the report?

+3
source share
3 answers

, , - Flurry, , .

ViewModel IAnalytics, IAnalytics, :

WP7:

public class FlurryAnalytics : IAnalytics
{
    public const string ApiKeyValue = "--- your key ---";

    public void StartSession()
    {
        FlurryWP7SDK.Api.StartSession(ApiKeyValue);
    }

    public void LogEvent(string eventName)
    {
        FlurryWP7SDK.Api.LogEvent(eventName);
    }
}

Touch ( https://github.com/kevinmcmahon/monotouch-libs/blob/master/FlurryAnalytics/flurry.cs):

public class FlurryAnalytics : IAnalytics
{
    public const string ApiKeyValue = "37SHD8L8VATPBS88AMHU";

    public void StartSession()
    {
        FlurryAPI.StartSession (ApiKeyValue);
    }

    public void LogEvent(string eventName)
    {
        FlurryAPI.LogEvent(eventName);
    }
}

Android ( - / ):

public class FlurryAnalytics : IAnalytics, IAndroidActivityTracker
{
    public const string ApiKeyValue = "--- your key ---";

    private readonly IntPtr _flurryClass;
    private readonly IntPtr _flurryOnStartSession;
    private readonly IntPtr _flurryOnEndSession;
    private readonly IntPtr _flurryLogEvent;

    public FlurryAnalytics()
    {
        _flurryClass = JNIEnv.FindClass("com/flurry/android/FlurryAgent");
        _flurryOnStartSession = JNIEnv.GetStaticMethodID(_flurryClass, "onStartSession",
                                                         "(Landroid/content/Context;Ljava/lang/String;)V");
        _flurryOnEndSession = JNIEnv.GetStaticMethodID(_flurryClass, "onEndSession", "(Landroid/content/Context;)V");
        _flurryLogEvent = JNIEnv.GetStaticMethodID(_flurryClass, "logEvent", "(Ljava/lang/String;)V");
    }

    public void StartSession()
    {
        // not used in Android - Android relies on Activity tracking instead
    }

    public void LogEvent(string eventName)
    {
        ExceptionSafe(() => JNIEnv.CallStaticVoidMethod(_flurryClass, _flurryLogEvent, new JValue(new Java.Lang.String(eventName))));
    }

    private static void ExceptionSafe(Action action)
    {
        try
        {
            action();
        }
        catch (ThreadAbortException)
        {
            throw;
        }
        catch (Exception exception)
        {
            UITrace.Trace("Exception seen in calling Flurry through JNI " + exception.ToLongString());
        }
    }

    public void OnStartActivity(Activity activity)
    {
        ExceptionSafe(() => JNIEnv.CallStaticVoidMethod(_flurryClass, _flurryOnStartSession, new JValue(activity), new JValue(new Java.Lang.String(ApiKeyValue))));
    }

    public void OnStopActivity(Activity activity)
    {
        ExceptionSafe(() => JNIEnv.CallStaticVoidMethod(_flurryClass, _flurryOnEndSession, new JValue(activity)));
    }
}

Flurry , , , :

, , , MonoDroid MonoTouch.

+1

MonoDroid Crasher ACRA. - Mono , ,.NET, ACRA MonoDroid. , .

+1

HockeyApp iOS SDK ( , Android).
, , MonoTouch.

0

All Articles