Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Commit

Permalink
Better documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Norne9 committed Dec 30, 2022
1 parent 08e1b9f commit d2550d7
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v1.0.1

- Better documentation

## v1.0.0

- The first version of the package
69 changes: 65 additions & 4 deletions Documentation~/com.norne.anrwatchdog.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,65 @@
# ANR Watchdog

## Watchdog
## Overview

This package will allow you to reduce the number of ANRs of your application.
This is achieved by using a watchdog timer which will restart the application in case something goes wrong.
This package will allow you to reduce the number of ANRs of your application. This is achieved by using a watchdog timer
which will restart the application in case something goes wrong.

## Installation instructions

[Official Package Manager installation instructions](https://docs.unity3d.com/Manual/upm-ui-install.html)

## Workflows

After adding the package to your project you are ready to go!

### Timeout Configuration

You can change the timeout after which your app will restart. The ANR detection timeout in Android is 10 seconds.
Therefore, I recommend keeping it below this value. The default value is 9 seconds.

Example:

```csharp
using Norne;
using UnityEngine;

public class ChangeTimeout: MonoBehaviour
{
private void Start()
{
// Set timeout to 8 seconds
Watchdog.Timeout = 8f;
}
}
```

### Analytics

Using this package prevents ANR data from being automatically sent to Google Play. If you are interested in this data
you can still receive it and send it to any analytics service.

Example code:

```csharp
using Norne;
using UnityEngine;

public class SendStacktrace: MonoBehaviour
{
private void Start()
{
// Check if we got an ANR the last time we ran the application
if (Watchdog.TryGetStacktrace(out var stacktrace))
{
// If we did, send it to our analytics service
Analytics.Send("ANR", stacktrace);
}
}
}
```

## Reference

### Watchdog.Timeout

Expand Down Expand Up @@ -56,4 +112,9 @@ public class SendStacktrace: MonoBehaviour
}
}
}
```
```

## Samples

- **Watchdog Sample** -
Contains a sample that shows how the app reacts to ANRs and how to change the timeout
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.norne.anrwatchdog",
"version": "1.0.0",
"version": "1.0.1",
"description": "This package will allow you to reduce the number of ANRs of your application. This is achieved by using a watchdog timer which will restart the application in case something goes wrong.",
"displayName": "ANR Watchdog",
"unity": "2018.4",
Expand Down

0 comments on commit d2550d7

Please sign in to comment.