Home

Awesome

Bugfender bindings for .NET MAUI

Bugfender is a tool to aggregate all your mobile application logs in a single place, so you can access them remotely. This repository provides bindings for iOS and Android on MAUI projects. Also provides a sample solution that shows the integration.

In order to use Bugfender, you will need an account which you can create here.

Usage

Add the NuGet to your project

Add the Bugfender.Sdk NuGet to your .NET MAUI project.

Adding Bugfender to your iOS project

using Bugfender.Sdk;

// ...

    public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
    {
        BugfenderBinding bugfender = BugfenderBinding.Instance;
        bugfender.Init(new BugfenderOptions
        {
            appKey = "YOUR APP KEY",
            // apiUri = new Uri("https://api.bugfender.com"),
            // baseUri = new Uri("https://dashboard.bugfender.com"),
            printToConsole = true,
            nativeCrashReporting = true,
            mauiCrashReporting = true,
            logUIEvents = true,
            // maximumLocalStorageSize = 5*1024*1024,
        });
        // some examples on how to use Bugfender
        bugfender.WriteLine("Logs for this device are here: {0}", bugfender.DeviceUri.ToString());
        bugfender.Warning("TAG", "This is a warning");
        bugfender.Error("TAG", "This is an error!");
        bugfender.SetDeviceString("user", "test@example.com");
        return base.FinishedLaunching(application, launchOptions);
    }

Adding Bugfender to your Android project

using Android.App;
using Android.Runtime;
using Bugfender.Sdk;

[Application]
public class MainApplication : Application
{
    public MainApplication(IntPtr handle, JniHandleOwnership ownerShip) : base(handle, ownerShip)
    {
    }

    public override void OnCreate()
    {
        base.OnCreate();
        BugfenderBinding bugfender = BugfenderBinding.Instance;
        bugfender.Init(this, new BugfenderOptions
        {
            appKey = "YOUR APP KEY",
            // apiUri = new Uri("https://api.bugfender.com"),
            // baseUri = new Uri("https://dashboard.bugfender.com"),
            printToConsole = true,
            nativeCrashReporting = true,
            mauiCrashReporting = true,
            logUIEvents = true,
            // maximumLocalStorageSize = 5*1024*1024,
        });
        // some examples on how to use Bugfender
        bugfender.WriteLine("Logs for this device are here: {0}", bugfender.DeviceUri.ToString());
        bugfender.Warning("TAG", "This is a warning");
        bugfender.Error("TAG", "This is an error!");
    }
}

Quick reference

Setup:

Other BugfenderBinding methods that let you control behavior and enable integrations:

Sending logs:

Tip: If your project is currently using Console/Trace/Debug to write logs, you can search & replace them to Bugfender to get started quickly.

Custom device-associated data:

Send rich data:

Full reference

This project is wrapping the native iOS and Android SDKs. You have the full reference here:

Troubleshooting

Contributions

Thanks to @AlonRom for their contributions to this project (conversion from Xamarin to .NET MAUI).