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

Commit

Permalink
Documentation done
Browse files Browse the repository at this point in the history
  • Loading branch information
Norne9 committed Dec 30, 2022
1 parent a174ae5 commit e06e4bc
Show file tree
Hide file tree
Showing 27 changed files with 440 additions and 3 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
**/.DS_Store
*.meta

5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## v1.0.0

- The first version of the package
7 changes: 7 additions & 0 deletions CHANGELOG.md.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions Documentation~/com.norne.anrwatchdog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# ANR Watchdog

## Watchdog

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.

### Watchdog.Timeout

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;
}
}
```

### Watchdog.TryGetStacktrace(out string stacktrace)

Allows you to get the stack trace of an application if it has terminated on a watchdog timer.

| Name | Description |
| ---- | ----------- |
| stacktrace | *System.String*<br>Stack trace of the main java thread of an application. In JSON format. |

#### Returns

True in case an application has terminated on a watchdog timer. False otherwise.

##### Example:

```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);
}
}
}
```
7 changes: 7 additions & 0 deletions LICENSE.md.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 68 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# ANR Watchdog

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.

## How to use

Just add the package to your project and you are ready to go!

## Installing package

Open package manager and select "Add package from git URL..."

![image](https://user-images.githubusercontent.com/4660466/210089474-7c064036-38b1-4908-948a-8c22d0cc8f23.png)

Enter package url:

```
https://github.com/Norne9/Unity-ANR-Watchdog.git
```

And click "Add"

## 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);
}
}
}
```
7 changes: 7 additions & 0 deletions README.md.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Runtime.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Runtime/IWatchdog.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Runtime/Implementations.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Runtime/Implementations/AndroidWatchdog.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Runtime/Implementations/DefaultWatchdog.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Runtime/Norne.ANRWatchdog.asmdef.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Runtime/Plugins.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Runtime/Plugins/Android.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 80 additions & 0 deletions Runtime/Plugins/Android/ANRWatchdog-release.aar.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 80 additions & 0 deletions Runtime/Plugins/Android/process-phoenix-2.1.2.aar.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e06e4bc

Please sign in to comment.