Skip to content

Commit f89ae0d

Browse files
committed
detectscreenshot v1.0.0
1 parent 874954c commit f89ae0d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+3738
-0
lines changed
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: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
import SetupAPM from '../../_includes/apm/setup-apm.mdx'
9+
10+
<SetupAPM />
11+
12+
13+
### Install the extension
14+
15+
Install the extension by running:
16+
17+
```
18+
apm install com.distriqt.DetectScreenshot
19+
```
20+
21+
This will download and install the extension, required assets, and all dependencies.
22+
23+
Once complete `apm` will have created something like the following file structure:
24+
25+
```
26+
.
27+
|____ ane
28+
| |____ com.distriqt.DetectScreenshot.ane # DetectScreenshot extension
29+
| |____ [dependencies]
30+
|____ apm_packages # cache directory - ignore
31+
|____ project.apm # apm project file
32+
```
33+
34+
- Add the `ane` directory to your IDE. *See the tutorials located [here](/docs/tutorials/getting-started) on adding an extension to your IDE.*
35+
36+
37+
:::info
38+
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.
39+
:::
40+
41+
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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.DetectScreenshot</extensionID>
9+
<extensionID>com.distriqt.Core</extensionID>
10+
<extensionID>androidx.core</extensionID>
11+
<extensionID>com.jetbrains.kotlin</extensionID>
12+
</extensions>
13+
```
14+
15+
16+
17+
## iOS
18+
19+
20+
### Info Additions
21+
22+
23+
The following additions are for the `InfoAdditions` node of the iPhone section in your application descriptor:
24+
25+
```xml
26+
<iPhone>
27+
<InfoAdditions><![CDATA[
28+
29+
HERE
30+
31+
]]></InfoAdditions>
32+
</iPhone>
33+
```
34+
35+
36+
37+
## Android
38+
39+
### Manifest Additions
40+
41+
The DetectScreenshot extension requires a few additions to the manifest to be able to start certain activities. You should add the listing below to your manifest.
42+
43+
:::caution
44+
Ensure you replace:
45+
- `APPLICATION_PACKAGE` with your AIR application's Java package name, something like `air.com.distriqt.test`. Generally this is your AIR application id prefixed by `air.` unless you have specified no air flair in your build options.
46+
:::
47+
48+
49+
```xml
50+
<manifest android:installLocation="auto">
51+
<uses-permission android:name="android.permission.INTERNET"/>
52+
53+
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES"/>
54+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32" />
55+
56+
<application android:hardwareAccelerated="true">
57+
58+
<activity android:name="com.distriqt.core.auth.AuthorisationActivity" android:exported="false" android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
59+
60+
</application>
61+
</manifest>
62+
```
63+
64+
65+
66+
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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 extension is required by this extension. You must include this extension in your application.
24+
25+
The Core extension 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+
30+
31+
32+
### Android Support
33+
34+
The Android Support libraries encompass the Android Support, Android X and common Google libraries.
35+
36+
These libraries are specific to Android. There are no issues including these on all platforms, they are just **required** for Android.
37+
38+
This extension requires the following extensions:
39+
40+
- [androidx.core](https://github.com/distriqt/ANE-AndroidSupport/raw/master/lib/androidx.core.ane)
41+
- [com.jetbrains.kotlin](https://github.com/distriqt/ANE-AndroidSupport/raw/master/lib/com.jetbrains.kotlin.ane)
42+
43+
You can access these extensions here: [https://github.com/distriqt/ANE-AndroidSupport](https://github.com/distriqt/ANE-AndroidSupport).
44+
45+
46+
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
title: Add the Extension
3+
sidebar_label: AIR
4+
---
5+
6+
import Tabs from '@theme/Tabs'
7+
import TabItem from '@theme/TabItem'
8+
9+
import InstallAPM from './_includes/add-apm.mdx'
10+
import InstallManual from './_includes/add-manual.mdx'
11+
12+
import AppDescriptorAPM from './_includes/add-apm-appdescriptor.mdx'
13+
import AppDescriptorManual from './_includes/add-manual-appdescriptor.mdx'
14+
15+
16+
17+
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).
18+
19+
However you can choose to install it manually, as you would have done in the past.
20+
21+
22+
## Install
23+
24+
<Tabs
25+
Id="packagemanager"
26+
defaultValue="apm"
27+
values={[
28+
{label: 'APM', value: 'apm'},
29+
{label: 'Manual', value: 'manual'},
30+
]}>
31+
32+
<TabItem value="apm" >
33+
<InstallAPM/>
34+
</TabItem>
35+
<TabItem value="manual" >
36+
<InstallManual/>
37+
</TabItem>
38+
39+
</Tabs>
40+
41+
42+
## Application Descriptor
43+
44+
<Tabs
45+
Id="packagemanager"
46+
defaultValue="apm"
47+
values={[
48+
{label: 'APM', value: 'apm'},
49+
{label: 'Manual', value: 'manual'},
50+
]}>
51+
52+
<TabItem value="apm" >
53+
<AppDescriptorAPM/>
54+
</TabItem>
55+
<TabItem value="manual" >
56+
<AppDescriptorManual/>
57+
</TabItem>
58+
59+
</Tabs>
60+
61+
62+
63+
## Checking for Support
64+
65+
You can use the `isSupported` flag to determine if this extension is supported on the current platform and device.
66+
67+
This allows you to react to whether the functionality is available on the device and provide an alternative solution if not.
68+
69+
70+
```actionscript
71+
if (DetectScreenshot.isSupported)
72+
{
73+
// Functionality here
74+
}
75+
```
76+
77+
78+
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
---
2+
title: Add the Plugin
3+
sidebar_label: Unity
4+
---
5+
6+
First step is always to add the plugin to your development environment.
7+
8+
9+
## Asset Store
10+
11+
Open the Asset Store in your browser and add the plugin to your assets.
12+
13+
Open the Package Manager (Window > Package Manager) in the Unity Editor and select the "My Assets" section. Select the plugin, and click Import in the bottom right.
14+
15+
16+
## Manual Installation
17+
18+
In unity you import the package by selecting `Assets / Import Package / Custom Package ...` and then browsing to the unity plugin package file: `com.distriqt.DetectScreenshot.unitypackage`.
19+
20+
![](images/unity-import-package.png)
21+
22+
You can manually download the extension from our repository:
23+
24+
- https://github.com/distriqt/ANE-DetectScreenshot
25+
26+
27+
28+
## Import the Plugin
29+
30+
31+
This will present the import dialog and display all the files for the plugin, make sure all the files are selected.
32+
33+
The plugin will be added to your project and you can now use the plugins functionality in your application.
34+
35+
36+
37+
38+
## Resolve Android Dependencies
39+
40+
This plugin depends on some common Android libraries, particularly the Google Play Core Library, which enables in-app reviews.
41+
42+
You can get these dependencies using one of the following methods.
43+
44+
45+
### Unity Jar Resolver
46+
47+
This is the suggested method.
48+
49+
Use the *Unity Jar Resolver* plugin to download and manage the Android dependencies.
50+
51+
52+
53+
#### Importing
54+
55+
> If you already use the *Unity Jar Resolver* in your project you can skip this step.
56+
57+
- Download the latest version of the [*Unity Jar Resolver*](https://github.com/googlesamples/unity-jar-resolver/releases)
58+
- Import the plugin by selecting `Assets / Import Package / Custom Package ...` and locate the plugin you downloaded. The plugin will be in the zip named: `external-dependency-manager-latest.unitypackage`
59+
- In the *Import Unity Package* window, click Import
60+
61+
62+
#### Resolving
63+
64+
By default, the resolver should run automatically and will add the dependencies required by this plugin.
65+
66+
If you have need to resolve the dependencies manually then you will need to:
67+
68+
- Open the menu under: `Assets / External Dependency Manager / Android Resolver`
69+
- Select `Resolve` or `Force Resolve`
70+
71+
72+
More information on the *Unity Jar Resolver* can be found [here](https://github.com/googlesamples/unity-jar-resolver)
73+
74+
75+
76+
### Custom Gradle DetectScreenshot
77+
78+
Unity's in-built gradle build support and exporting to android studio does not support per plugin gradle script. Therefore, this plugin cannot add the dependencies by itself.
79+
80+
The `mainDetectScreenshot.gradle` is generated when you enable the **Custom Gradle DetectScreenshot** property on the Player window.
81+
82+
The `build.gradle` exists in generated Gradle project when you enable the **Export Project** property on the Player window and Build the project.
83+
84+
Update the `dependencies` section in your `mainDetectScreenshot.gradle` or `build.gradle` as below:
85+
86+
```
87+
dependencies {
88+
compile fileTree(dir: 'libs', include: ['*.jar'])
89+
90+
implementation 'com.google.android.play:core:1.9.1'
91+
}
92+
```
93+
94+
95+
## Checking for Support
96+
97+
You can use the `isSupported` flag to determine if this extension is supported on the current platform and device.
98+
99+
This allows you to react to whether the functionality is available on the device and provide an alternative solution if not.
100+
101+
102+
```csharp
103+
if (DetectScreenshot.isSupported)
104+
{
105+
// Functionality here
106+
}
107+
```

0 commit comments

Comments
 (0)