Skip to content

Commit 753d80d

Browse files
committed
Update docs to use apm
1 parent 5cae33c commit 753d80d

File tree

10 files changed

+286
-0
lines changed

10 files changed

+286
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ your application to your own error logging server.
2424

2525
## Documentation
2626

27+
Latest documentation can be found in the [documentation site](https://docs.airnativeextensions.com/docs/exceptions) along with the [asdocs](https://docs.airnativeextensions.com/asdocs/exceptions).
28+
29+
2730
This extension is very simple in the implementation, having only 2 main functions.
2831

2932
To start catching exceptions you simply call `setUncaughtExceptionHandler()` at
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
3+
Updating your application descriptor will insert the required `extensionID`'s and generate the manifest and info additions for your application.
4+
5+
You update your application descriptor by running:
6+
7+
```
8+
apm generate app-descriptor src/MyApp-app.xml
9+
```
10+
11+
Change the path (`src/MyApp-app.xml`) to point to your application descriptor.
12+
13+
:::caution
14+
This will modify your application descriptor replacing the manifest additions and info additions with the ones generated from `apm`.
15+
16+
You should backup your application descriptor before running this command to ensure you don't lose any information.
17+
18+
If you need to insert custom data into these sections see the guides for [Android](https://github.com/airsdk/apm/wiki/Usage-Generate#android) and [iOS](https://github.com/airsdk/apm/wiki/Usage-Generate#ios)
19+
:::
20+
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
2+
3+
4+
:::info
5+
Note: All of the commands below should be run in a terminal / command prompt in the root directory of your application, generally the level above your source directory.
6+
:::
7+
8+
**If you don't have an APM project setup, expand the guide below to setup an APM project before installing the extension.**
9+
10+
<details><summary>Setup APM</summary>
11+
<p>
12+
13+
### Install APM
14+
15+
If you haven't installed `apm` follow the install guide on [airsdk.dev](https://airsdk.dev/docs/basics/install-apm).
16+
17+
18+
### Setup an APM project
19+
20+
You will need an APM project for your application.
21+
22+
23+
There are many ways to do this and for more options see the [APM documentation](https://github.com/airsdk/apm/wiki/Usage-ProjectsAndPackages#initialise). Here we will just initialise a new empty project:
24+
25+
```
26+
apm init
27+
```
28+
29+
#### Check your github token
30+
31+
We use github to secure our extensions so you must have created a github personal access token and configured `apm` to use it.
32+
33+
To do this create a token using this [guide from github](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token) and then set it in your apm config using:
34+
35+
```
36+
apm config set github_token ghp_XXXXXXXXXXXXXXXXXXXXXXXXXXXX
37+
```
38+
39+
If you don't do this correctly you may find the install will fail.
40+
41+
</p>
42+
</details>
43+
44+
45+
### Install the extension
46+
47+
Install the extension by running:
48+
49+
```
50+
apm install com.distriqt.Exceptions
51+
```
52+
53+
This will download and install the extension, required assets, and all dependencies.
54+
55+
Once complete `apm` will have created something like the following file structure:
56+
57+
```
58+
.
59+
|____ ane
60+
| |____ com.distriqt.Exceptions.ane # Exceptions extension
61+
| |____ [dependencies]
62+
|____ apm_packages # cache directory - ignore
63+
|____ project.apm # apm project file
64+
```
65+
66+
- Add the `ane` directory to your IDE. *See the tutorials located [here](/docs/tutorials/getting-started) on adding an extension to your IDE.*
67+
68+
:::info
69+
We suggest you use the locations directly in your builds rather than copying the files elsewhere. The reason for this is if you ever go to update the extensions using `apm` that these updates will be pulled into your build automatically.
70+
:::
71+
72+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
### Extension IDs
3+
4+
The following should be added to your `extensions` node in your application descriptor to identify all the required ANEs in your application:
5+
6+
```xml
7+
<extensions>
8+
<extensionID>com.distriqt.Exceptions</extensionID>
9+
<extensionID>com.distriqt.Core</extensionID>
10+
</extensions>
11+
```
12+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
:::info
3+
The following guide is used to manually install the extension, download dependencies and update the application descriptor. We highly recommend installing extensions using `apm`. Using `apm` will automate the installation and automatically handle updates and dependencies along with greatly simplifying the application descriptor generation.
4+
:::
5+
6+
7+
First step is always to add the extension to your development environment. Download the extension from the repository and then follow the tutorial located [here](/docs/tutorials/getting-started) to add the extension to your development environment.
8+
9+
10+
11+
12+
### Dependencies
13+
14+
Many of our extensions use some common libraries, for example, the Android Support libraries.
15+
16+
We have to separate these libraries into separate extensions in order to avoid multiple versions of the libraries being included in your application and causing packaging conflicts. This means that you need to include some additional extensions in your application along with the main extension file.
17+
18+
You will add these extensions as you do with any other extension, and you need to ensure it is packaged with your application.
19+
20+
21+
#### Core
22+
23+
The Core ANE is required by this ANE. You must include and package this extension in your application.
24+
25+
The Core ANE doesn't provide any functionality in itself but provides support libraries and frameworks used by our extensions.
26+
It also includes some centralised code for some common actions that can cause issues if they are implemented in each individual extension.
27+
28+
You can access this extension here: [https://github.com/distriqt/ANE-Core](https://github.com/distriqt/ANE-Core).
29+
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
title: Add the Extension
3+
sidebar_label: Add the Extension
4+
---
5+
6+
import Tabs from '@theme/Tabs'
7+
import TabItem from '@theme/TabItem'
8+
9+
import InstallAPM from './_includes/add-apm.md'
10+
import InstallManual from './_includes/add-manual.md'
11+
12+
import AppDescriptorAPM from './_includes/add-apm-appdescriptor.md'
13+
import AppDescriptorManual from './_includes/add-manual-appdescriptor.md'
14+
15+
16+
The simplest way to install and manage your AIR native extensions and libraries is to use the AIR Package Manager (`apm`). We highly recommend using `apm`, as it will handle downloading all required dependencies and manage your application descriptor (Android manifest additions, iOS info additions etc).
17+
18+
However you can choose to install it manually, as you would have done in the past.
19+
20+
## Install
21+
22+
<Tabs
23+
groupId="packagemanager"
24+
defaultValue="apm"
25+
values={[
26+
{label: 'APM', value: 'apm'},
27+
{label: 'Manual', value: 'manual'},
28+
]}>
29+
30+
<TabItem value="apm" >
31+
<InstallAPM/>
32+
</TabItem>
33+
<TabItem value="manual" >
34+
<InstallManual/>
35+
</TabItem>
36+
37+
</Tabs>
38+
39+
40+
## Application Descriptor
41+
42+
<Tabs
43+
groupId="packagemanager"
44+
defaultValue="apm"
45+
values={[
46+
{label: 'APM', value: 'apm'},
47+
{label: 'Manual', value: 'manual'},
48+
]}>
49+
50+
<TabItem value="apm" >
51+
<AppDescriptorAPM/>
52+
</TabItem>
53+
<TabItem value="manual" >
54+
<AppDescriptorManual/>
55+
</TabItem>
56+
57+
</Tabs>
58+
59+
60+
61+
## Checking for Support
62+
63+
You can use the `isSupported` flag to determine if this extension is supported on the current platform and device.
64+
65+
This allows you to react to whether the functionality is available on the device and provide an alternative solution if not.
66+
67+
68+
```actionscript
69+
if (Exceptions.isSupported)
70+
{
71+
// Functionality here
72+
}
73+
```
47.4 KB
Loading
153 KB
Loading

docs/site/docs/exceptions/index.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
title: Exceptions
3+
hide_title: true
4+
slug: /exceptions/
5+
---
6+
7+
![Exceptions](images/promo.png)
8+
9+
# Exceptions
10+
11+
Exceptions is an AIR Native Extension to enable a global exception handler for iOS and Android.
12+
13+
This will catch and store information about crashes of your application allowing you to process
14+
them on the next application run. In using this extension you can report crashes and errors in
15+
your application to your own error logging server.
16+
17+
18+
### Features
19+
20+
- Catch exceptions
21+
- Process exceptions on startup
22+
- Single API interface - your code works across supported platforms with no modifications
23+
- Sample project code and ASDocs reference
24+
25+
26+
## Documentation
27+
28+
Latest documentation can be found in the [documentation site](https://docs.airnativeextensions.com/docs/exceptions) along with the [asdocs](https://docs.airnativeextensions.com/asdocs/exceptions).
29+
30+
Quick Example:
31+
32+
```actionscript
33+
Exceptions.service.setUncaughtExceptionHandler();
34+
```
35+
36+
37+
## Acknowledgements
38+
39+
This extension was made possible with support by [MovieStarPlanet](http://corporate.moviestarplanet.com/)
40+
41+
![MovieStarPlanet](images/msp_logo.png)
42+

docs/site/docs/exceptions/usage.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
title: Usage
3+
sidebar_label: Usage
4+
---
5+
6+
This extension is very simple in the implementation, having only 2 main functions.
7+
8+
To start catching exceptions you simply call `setUncaughtExceptionHandler()` at
9+
some point at the beginning of your application.
10+
11+
```actionscript
12+
Exceptions.service.setUncaughtExceptionHandler();
13+
```
14+
15+
16+
To check if your application crashed previously you use the `hasPendingException()` function.
17+
18+
```actionscript
19+
if (Exceptions.service.hasPendingException())
20+
{
21+
var report:ExceptionReport = Exceptions.service.getPendingException();
22+
trace( "date: "+ new Date(report.timestamp).toLocaleString() );
23+
trace( "name: "+ report.name );
24+
trace( "reason: "+ report.reason );
25+
trace( "report: "+ report.report );
26+
}
27+
```
28+
29+
:::note
30+
You can generally only have **one** exception handler in an application.
31+
32+
So if you are using another library that tracks exceptions (Google Analytics or a bug tracker) then the functionality provided here may not work or may stop the library from working.
33+
34+
You should decide which is the more important method and ensure only one method is used in your application.
35+
:::

0 commit comments

Comments
 (0)