You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
APM is the AIR Package Manager which allows management of AIR libraries and extensions and assists in creation of the application descriptor.
The initial goal of APM is simplify the setup and updating of an AIR application, in particular mobile applications, where the environment and SDKs (extensions) change rapidly.
Here I will show you how to create a new AIR application and use apm to add a dependency.
Installation
Installation is a manual process at the moment and is still a work in progress. To install firstly download the latest release from the apm releases and then follow the guide to setup your environment correctly. Basically the goal is to ensure you have:
extracted the release to a location;
made the location available in your PATH;
You need to ensure you have at least AIR SDK v33.1.1.554 installed.
Once installed you should be able to open a terminal and enter:
apm -version
This will output the version of the tool.
Create a Project
Firstly, let's create a directory for our project, you can create a new empty directory or you can use a new project directory created through an IDE. The key is to open a terminal at the location where you would normally place a src directory containing all your actionscript source code.
Let's initialise a new project by running apm init. This will run through some basic questions to setup the project configuration:
❯ apm init
Creating new project definition file
Application Identifier [com.my.app]: com.example.app
Application Name [My Application]: Example App
Application Version [1.0.0]: 1.0.0
Your directory will now contain a project.apm file. This is the file that contains all the information about your project including installed packages, versions and configuration values. You shouldn't need to edit this file directly but feel free to have a look at the contents (it is a json formatted text file).
Install a Package
Next let's search for a package to install. We will look for an "IDFA" extension to be able to get an advertising identifier for a user. Searching is done by calling apm search [query] so:
apm search IDFA
This will run as below and finds the com.distriqt.IDFA extension:
> apm search IDFA
✓ Search complete
found [1] matching package(s) for search 'IDFA'
└──com.distriqt.IDFA@5.0.31 The IDFA extension gives you simple access to the advertising identifiers on Android and iOS.
Let's go ahead and install this extension:
apm install com.distriqt.IDFA
This will get the details of the extension, and dependencies and install all the required extensions:
Each of these is downloaded and installed along with the main com.distriqt.IDFA extension. Once complete you will have the following directory structure created:
The apm_packages directory is a cache directory, where apm keeps all your installed packages and details on them. The contents of this directory are used for apm operations so don't modify the contents of this directory. It is completely recreatable though by running apm install so you can add it to your .gitignore (or similar version control system) and just run apm install when starting development. Feel free to try that now, i.e. delete the apm_packages directory and run apm install. You should see something similar to the original install command output and the cache recreated.
Add to your IDE
Next lets open up your IDE and add the outputs from apm to your IDE.
In this case we have an ane directory containing the extensions. For example, in IntelliJ I would open up the module settings and add the ane directory as a dependency:
If you had installed a package with a SWC then you would also have a libs directory containing the swc files, and if you installed a package with source code then you may have a libs_src directory containing the package source code.
Similarly you should add these two directories to your build if they are present.
Check Configuration
Next you should check the project configuration to check if you want to make any changes to the configuration parameters that will be used for the extensions.
To do this run apm project config which will output all the current configuration parameters for your project:
> apm project config
userTrackingUsageDescription=Allows us to deliver personalized ads for you.
You will see there is one configuration parameter for the IDFA extension, which is the usage description that is used in the App Tracking Transparency dialog on iOS. If you wish to update it use the config set command: apm project config set <param> <value>
> apm project config set userTrackingUsageDescription "Better advertising for you."
Check it updated correctly by using:
❯ apm project config
userTrackingUsageDescription=Better advertising for you.
Generate the Application Descriptor
The next step which is particularly important for extensions, is to generate the application descriptor by calling apm generate app-descriptor. This will create an application descriptor with all the correct manifest additions, info additions and extensions for you to build your application.
The default is output to src/APPNAME-app.xml.
Note: If you already have an application descriptor at src/APPNAME-app.xml then it will be used as a template. The id, version, manifestAdditions, InfoAdditions, and Entitlements sections will be overwritten and the extensions will be corrected to ensure the required extensions are added.
Your application package name will be correctly inserted into appropriate spots, all permissions and manifest entries will be inserted and merged correctly and configuration parameters applied.
Now it is time to start writing code. You will see all the work of reading documentation and downloading the correct dependencies and adding manifest additions has been reduced to two commands:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
APM is the AIR Package Manager which allows management of AIR libraries and extensions and assists in creation of the application descriptor.
The initial goal of APM is simplify the setup and updating of an AIR application, in particular mobile applications, where the environment and SDKs (extensions) change rapidly.
Here I will show you how to create a new AIR application and use
apm
to add a dependency.Installation
Installation is a manual process at the moment and is still a work in progress. To install firstly download the latest release from the apm releases and then follow the guide to setup your environment correctly. Basically the goal is to ensure you have:
PATH
;You need to ensure you have at least AIR SDK v33.1.1.554 installed.
Once installed you should be able to open a terminal and enter:
This will output the version of the tool.
Create a Project
Firstly, let's create a directory for our project, you can create a new empty directory or you can use a new project directory created through an IDE. The key is to open a terminal at the location where you would normally place a
src
directory containing all your actionscript source code.Let's initialise a new project by running
apm init
. This will run through some basic questions to setup the project configuration:Your directory will now contain a
project.apm
file. This is the file that contains all the information about your project including installed packages, versions and configuration values. You shouldn't need to edit this file directly but feel free to have a look at the contents (it is a json formatted text file).Install a Package
Next let's search for a package to install. We will look for an "IDFA" extension to be able to get an advertising identifier for a user. Searching is done by calling
apm search [query]
so:This will run as below and finds the
com.distriqt.IDFA
extension:Let's go ahead and install this extension:
This will get the details of the extension, and dependencies and install all the required extensions:
You can see this extension has 4 dependencies:
com.distriqt.playservices.Base
com.distriqt.playservices.AdsIdentifier
com.distriqt.Core
androidx.core
Each of these is downloaded and installed along with the main
com.distriqt.IDFA
extension. Once complete you will have the following directory structure created:The
apm_packages
directory is a cache directory, whereapm
keeps all your installed packages and details on them. The contents of this directory are used for apm operations so don't modify the contents of this directory. It is completely recreatable though by runningapm install
so you can add it to your.gitignore
(or similar version control system) and just runapm install
when starting development. Feel free to try that now, i.e. delete theapm_packages
directory and runapm install
. You should see something similar to the original install command output and the cache recreated.Add to your IDE
Next lets open up your IDE and add the outputs from
apm
to your IDE.In this case we have an
ane
directory containing the extensions. For example, in IntelliJ I would open up the module settings and add theane
directory as a dependency:Check Configuration
Next you should check the project configuration to check if you want to make any changes to the configuration parameters that will be used for the extensions.
To do this run
apm project config
which will output all the current configuration parameters for your project:You will see there is one configuration parameter for the IDFA extension, which is the usage description that is used in the App Tracking Transparency dialog on iOS. If you wish to update it use the config set command:
apm project config set <param> <value>
Check it updated correctly by using:
Generate the Application Descriptor
The next step which is particularly important for extensions, is to generate the application descriptor by calling
apm generate app-descriptor
. This will create an application descriptor with all the correct manifest additions, info additions and extensions for you to build your application.The default is output to
src/APPNAME-app.xml
.Your application package name will be correctly inserted into appropriate spots, all permissions and manifest entries will be inserted and merged correctly and configuration parameters applied.
This creates the following:
Get Coding
Now it is time to start writing code. You will see all the work of reading documentation and downloading the correct dependencies and adding manifest additions has been reduced to two commands:
Open up your IDE and start coding, (you may now have to refer to the documentation for usage of the package though :) )
Beta Was this translation helpful? Give feedback.
All reactions