diff --git a/.gitignore b/.gitignore
index e92446a..79b5594 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1 @@
**/.DS_Store
-*.meta
-
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e69de29..1dd007e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -0,0 +1,5 @@
+# Changelog
+
+## v1.0.0
+
+- The first version of the package
diff --git a/CHANGELOG.md.meta b/CHANGELOG.md.meta
new file mode 100644
index 0000000..59d0318
--- /dev/null
+++ b/CHANGELOG.md.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: a9d7095a5a8d54dd1bf2b95297ea9c0c
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Documentation~/com.norne.anrwatchdog.md b/Documentation~/com.norne.anrwatchdog.md
index e69de29..2dc8703 100644
--- a/Documentation~/com.norne.anrwatchdog.md
+++ b/Documentation~/com.norne.anrwatchdog.md
@@ -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*
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);
+ }
+ }
+}
+```
\ No newline at end of file
diff --git a/LICENSE.md.meta b/LICENSE.md.meta
new file mode 100644
index 0000000..737c1eb
--- /dev/null
+++ b/LICENSE.md.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 91affd6256a824bee93afc2e4f625cf6
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/README.md b/README.md
index e69de29..e5b2c36 100644
--- a/README.md
+++ b/README.md
@@ -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..."
+
+
+
+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);
+ }
+ }
+}
+```
\ No newline at end of file
diff --git a/README.md.meta b/README.md.meta
new file mode 100644
index 0000000..aa7b18f
--- /dev/null
+++ b/README.md.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 9bf6abe352b0c48a6bc8c726f3cfbfc2
+TextScriptImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Runtime.meta b/Runtime.meta
new file mode 100644
index 0000000..20d74fc
--- /dev/null
+++ b/Runtime.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 2f4b125ad8b8347e19e1ab16e43c2b80
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Runtime/IWatchdog.cs.meta b/Runtime/IWatchdog.cs.meta
new file mode 100644
index 0000000..47ebae0
--- /dev/null
+++ b/Runtime/IWatchdog.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 4cfcf449e05e4eed9018e4df92a995e6
+timeCreated: 1672245865
\ No newline at end of file
diff --git a/Runtime/Implementations.meta b/Runtime/Implementations.meta
new file mode 100644
index 0000000..cbcf35b
--- /dev/null
+++ b/Runtime/Implementations.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: f4d5283edc4b4967afa3df8effb39abe
+timeCreated: 1672246076
\ No newline at end of file
diff --git a/Runtime/Implementations/AndroidWatchdog.cs.meta b/Runtime/Implementations/AndroidWatchdog.cs.meta
new file mode 100644
index 0000000..c11aeae
--- /dev/null
+++ b/Runtime/Implementations/AndroidWatchdog.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 683271618e4748a4952fb6647f144c74
+timeCreated: 1672246086
\ No newline at end of file
diff --git a/Runtime/Implementations/DefaultWatchdog.cs.meta b/Runtime/Implementations/DefaultWatchdog.cs.meta
new file mode 100644
index 0000000..412b9ac
--- /dev/null
+++ b/Runtime/Implementations/DefaultWatchdog.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 70e009a95c89452f88f80fd4aa5d6503
+timeCreated: 1672246105
\ No newline at end of file
diff --git a/Runtime/Norne.ANRWatchdog.asmdef.meta b/Runtime/Norne.ANRWatchdog.asmdef.meta
new file mode 100644
index 0000000..5f6234a
--- /dev/null
+++ b/Runtime/Norne.ANRWatchdog.asmdef.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 0b373a395e622411aa1246d01f5d0595
+AssemblyDefinitionImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Runtime/Plugins.meta b/Runtime/Plugins.meta
new file mode 100644
index 0000000..3dac420
--- /dev/null
+++ b/Runtime/Plugins.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: cf3c5fbb8ceb4434fa2805c1112b24d5
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Runtime/Plugins/Android.meta b/Runtime/Plugins/Android.meta
new file mode 100644
index 0000000..cb5f3a8
--- /dev/null
+++ b/Runtime/Plugins/Android.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 1c032945484d84cd7a38cde7c1a87a34
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Runtime/Plugins/Android/ANRWatchdog-release.aar.meta b/Runtime/Plugins/Android/ANRWatchdog-release.aar.meta
new file mode 100644
index 0000000..2f668aa
--- /dev/null
+++ b/Runtime/Plugins/Android/ANRWatchdog-release.aar.meta
@@ -0,0 +1,80 @@
+fileFormatVersion: 2
+guid: 32f4e0e7f37024fc9ba193841df2cbcd
+PluginImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ iconMap: {}
+ executionOrder: {}
+ defineConstraints: []
+ isPreloaded: 1
+ isOverridable: 1
+ isExplicitlyReferenced: 0
+ validateReferences: 1
+ platformData:
+ - first:
+ : Any
+ second:
+ enabled: 0
+ settings:
+ Exclude Android: 0
+ Exclude Editor: 1
+ Exclude Linux64: 1
+ Exclude OSXUniversal: 1
+ Exclude Win: 1
+ Exclude Win64: 1
+ Exclude iOS: 1
+ - first:
+ Android: Android
+ second:
+ enabled: 1
+ settings:
+ CPU: ARMv7
+ - first:
+ Any:
+ second:
+ enabled: 0
+ settings: {}
+ - first:
+ Editor: Editor
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ DefaultValueInitialized: true
+ OS: AnyOS
+ - first:
+ Standalone: Linux64
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ - first:
+ Standalone: OSXUniversal
+ second:
+ enabled: 0
+ settings:
+ CPU: None
+ - first:
+ Standalone: Win
+ second:
+ enabled: 0
+ settings:
+ CPU: x86
+ - first:
+ Standalone: Win64
+ second:
+ enabled: 0
+ settings:
+ CPU: x86_64
+ - first:
+ iPhone: iOS
+ second:
+ enabled: 0
+ settings:
+ AddToEmbeddedBinaries: false
+ CPU: AnyCPU
+ CompileFlags:
+ FrameworkDependencies:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Runtime/Plugins/Android/process-phoenix-2.1.2.aar.meta b/Runtime/Plugins/Android/process-phoenix-2.1.2.aar.meta
new file mode 100644
index 0000000..a15c760
--- /dev/null
+++ b/Runtime/Plugins/Android/process-phoenix-2.1.2.aar.meta
@@ -0,0 +1,80 @@
+fileFormatVersion: 2
+guid: e782583af2cf44538b5602d84666ce42
+PluginImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ iconMap: {}
+ executionOrder: {}
+ defineConstraints: []
+ isPreloaded: 1
+ isOverridable: 1
+ isExplicitlyReferenced: 0
+ validateReferences: 1
+ platformData:
+ - first:
+ : Any
+ second:
+ enabled: 0
+ settings:
+ Exclude Android: 0
+ Exclude Editor: 1
+ Exclude Linux64: 1
+ Exclude OSXUniversal: 1
+ Exclude Win: 1
+ Exclude Win64: 1
+ Exclude iOS: 1
+ - first:
+ Android: Android
+ second:
+ enabled: 1
+ settings:
+ CPU: ARMv7
+ - first:
+ Any:
+ second:
+ enabled: 0
+ settings: {}
+ - first:
+ Editor: Editor
+ second:
+ enabled: 0
+ settings:
+ CPU: AnyCPU
+ DefaultValueInitialized: true
+ OS: AnyOS
+ - first:
+ Standalone: Linux64
+ second:
+ enabled: 0
+ settings:
+ CPU: x86_64
+ - first:
+ Standalone: OSXUniversal
+ second:
+ enabled: 0
+ settings:
+ CPU: None
+ - first:
+ Standalone: Win
+ second:
+ enabled: 0
+ settings:
+ CPU: x86
+ - first:
+ Standalone: Win64
+ second:
+ enabled: 0
+ settings:
+ CPU: x86_64
+ - first:
+ iPhone: iOS
+ second:
+ enabled: 0
+ settings:
+ AddToEmbeddedBinaries: false
+ CPU: AnyCPU
+ CompileFlags:
+ FrameworkDependencies:
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Runtime/Watchdog.cs b/Runtime/Watchdog.cs
index 568e313..54633b9 100644
--- a/Runtime/Watchdog.cs
+++ b/Runtime/Watchdog.cs
@@ -3,10 +3,18 @@
namespace Norne
{
+ ///
+ /// 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.
+ ///
public static class Watchdog
{
private static IWatchdog _watchdog;
+ ///
+ /// The time after which the application will be restarted. Specified in seconds.
+ /// The default value is 9 seconds.
+ ///
public static float Timeout
{
get
@@ -40,6 +48,11 @@ private static void Start()
_watchdog.StartWatchdog(9f);
}
+ ///
+ /// Allows you to get the stack trace of an application if it has terminated on a watchdog timer.
+ ///
+ /// Stack trace of the main java thread of an application. In JSON format.
+ /// True in case an application has terminated on a watchdog timer. False otherwise.
public static bool TryGetStacktrace(out string stacktrace)
{
stacktrace = _watchdog.GetStacktrace();
diff --git a/Runtime/Watchdog.cs.meta b/Runtime/Watchdog.cs.meta
new file mode 100644
index 0000000..fe2f190
--- /dev/null
+++ b/Runtime/Watchdog.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: cf976389e09ca4bc796d9787301b2b63
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Samples~/Sample01/Scenes.meta b/Samples~/Sample01/Scenes.meta
new file mode 100644
index 0000000..5415ae8
--- /dev/null
+++ b/Samples~/Sample01/Scenes.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 22b690acf041c40da982365e1214736c
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Samples~/Sample01/Scenes/SampleScene.unity.meta b/Samples~/Sample01/Scenes/SampleScene.unity.meta
new file mode 100644
index 0000000..b2d93df
--- /dev/null
+++ b/Samples~/Sample01/Scenes/SampleScene.unity.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: b5005e2bf970840598d77d21f49a5825
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Samples~/Sample01/Scripts.meta b/Samples~/Sample01/Scripts.meta
new file mode 100644
index 0000000..0f61fd6
--- /dev/null
+++ b/Samples~/Sample01/Scripts.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: ce41bbb9c837f4f09ad4fa54b83ee43f
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Samples~/Sample01/Scripts/Norne.ANRWatchdog.Sample.asmdef.meta b/Samples~/Sample01/Scripts/Norne.ANRWatchdog.Sample.asmdef.meta
new file mode 100644
index 0000000..f38786b
--- /dev/null
+++ b/Samples~/Sample01/Scripts/Norne.ANRWatchdog.Sample.asmdef.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 9b3a613db224b47b1a262ff7d50c3d72
+AssemblyDefinitionImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Samples~/Sample01/Scripts/TextSlider.cs.meta b/Samples~/Sample01/Scripts/TextSlider.cs.meta
new file mode 100644
index 0000000..dd449d4
--- /dev/null
+++ b/Samples~/Sample01/Scripts/TextSlider.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 5b8a0b2d4e8de49ddb5b997f99e62de1
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Samples~/Sample01/Scripts/WatchdogExample.cs.meta b/Samples~/Sample01/Scripts/WatchdogExample.cs.meta
new file mode 100644
index 0000000..4748864
--- /dev/null
+++ b/Samples~/Sample01/Scripts/WatchdogExample.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 3199bccef453e4a9eab78dd3c9438bd4
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/package.json b/package.json
index ca4df8a..062f91f 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "com.norne.anrwatchdog",
- "version": "0.2.0",
+ "version": "1.0.0",
"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",
diff --git a/package.json.meta b/package.json.meta
new file mode 100644
index 0000000..5a3d4df
--- /dev/null
+++ b/package.json.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: c7dd7eb274ef549ff925154f7ede3d5b
+PackageManifestImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant: