I'm trying to use this repo to get ANR errors and log it into Crashlytics but unfortunately while debugging niether call back for SetANRListener is working nor SetANRInterceptor.
Here is how i'm using it.
in my MainActivity
new ANRWatchDog(1000).SetANRListener(new MyANRListener())
.SetIgnoreDebugger(true)
.SetANRInterceptor(new MyANRInterceptor())
// .SetReportMainThreadOnly()
.Start();
Classes for listeners
public class MyANRListener : ANRWatchDog.IANRListener
{
public void OnAppNotResponding(ANRError error)
{
//Handle the ANR error. log it to Crashlytics:
try
{
Crashlytics.Crashlytics.LogException(error);
} catch(Exception ex)
{
}
}
}
public class MyANRInterceptor : IANRInterceptor
{
string TAG = "ANR: ";
public long Intercept(long duration)
{
long ret = 5000 - duration;
if (ret > 0)
{
Log.Warn(TAG, $"Intercepted ANR that is too short ({duration} ms), postponing for {ret} ms");
}
return ret;
}
public MyANRInterceptor()
{
}
}
I'm trying with Thread.Sleep(10000); i'm getting ANR but none of your listener are getting hit while debugging.
I'm trying to use this repo to get ANR errors and log it into
Crashlyticsbut unfortunately while debugging niether call back for SetANRListener is working nor SetANRInterceptor.Here is how i'm using it.
in my MainActivity
Classes for listeners
I'm trying with
Thread.Sleep(10000);i'm getting ANR but none of your listener are getting hit while debugging.