-
-
Notifications
You must be signed in to change notification settings - Fork 11
Quick Start
This is a quick overview of the most common usage cases for using apm in AIR development.
Please ensure you have installed apm first.
First thing you will want to do is initialise your apm project. Make sure you are in the root of your application source, generally alongside your src
directory, and call:
apm init
This will run through some questions about your application and then create a project.apm file in the current directory. This is the file that will store all the information about the packages and configuration values used in your project.
apm init
Creating new project definition file
Application Identifier [com.my.app]: com.apm.test
Application Name [My Application]: APM Test
Application Consts [1.0.0]:
Identify a package you wish to install by using search
apm search <search_query>
This will search the apm repository and return a list of matched packages, eg:
apm search advert
✓ Search complete
found [2] matching package(s) for search 'advert'
├──[email protected] The IDFA extension gives you simple access to the advertising identifiers on Android and iOS.
└──[email protected] Adverts (AdMob)
Install a package using install
:
apm install <package_identifier>
This will install the latest version of a package and all of it's dependencies
apm install com.distriqt.IDFA
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
Installing package : [email protected]
✓ downloaded
✓ extracted
Installed package : [email protected]
Installing package : [email protected]
✓ downloaded
✓ extracted
Installed package : [email protected]
Installing package : [email protected]
✓ downloaded
✓ extracted
Installed package : [email protected]
Installing package : [email protected]
✓ downloaded
✓ extracted
Installed package : [email protected]
Installing package : [email protected]
✓ downloaded
✓ extracted
Installed package : [email protected]
✓ Deployed: [email protected]
✓ Deployed: [email protected]
✓ Deployed: [email protected]
✓ Deployed: [email protected]
✓ Deployed: [email protected]
After successfully running this command you will have a apm_packages
directory which contains all the cached packages (this directory shouldn't be deleted but can be ignored in version control, ie. add it to your .gitignore
file).
After installation you will have any native extensions in an ane
directory and any swc
in a libs
and any source packages in a libs_src
directory. You may also have some static content or files in an assets
directory.
For example after the above we have (ignoring the cache directory):
.
|____ane
| |____androidx.core.ane
| |____com.distriqt.Core.ane
| |____com.distriqt.IDFA.ane
| |____com.distriqt.playservices.AdsIdentifier.ane
| |____com.distriqt.playservices.Base.ane
|____project.apm
|____src
| |____Main.as
Once you have installed the package you can check the configuration parameters using apm project config
apm project config
userTrackingUsageDescription=Allows us to deliver personalized ads for you.
Here you see one configuration variable userTrackingUsageDescription
set to a default by the package. This value will be inserted into your application descriptor later.
If you wish to update any parameters use: apm project config set <param> <value>
apm project config set userTrackingUsageDescription "Get personalised ads"
Packages will use these configuration parameters for many different things, including usage strings, account id's and optional sdk settings.
If you need more information on the parameters in order to figure out what is required you can run apm project config describe
and the descriptions of each parameter (along with associated packages) will be displayed:
apm project config describe
# [com.distriqt.IDFA]: Usage description presented on iOS when authorisation is requested
userTrackingUsageDescription=Allows us to deliver personalized ads for you. (required)
After installing or updating a package you will want to update your application descriptor to include all the correct manifest additions and info additions.
apm generate app-descriptor
Android package name: air.com.apm.test
✓ Android manifest merge
✓ iOS additions merge complete
✓ iOS entitlements merge complete
✓ App descriptor generated: src/APMTest-app.xml
Now if you look at the APMTest-app.xml
you will find apm has created a basic application descriptor with all the required manifest and info additions for the IDFA extension you installed along with all the extension ids:
<application xmlns="http://ns.adobe.com/air/application/33.1">
<id>com.apm.test</id>
<versionNumber>1.0.0</versionNumber>
<filename>APMTest</filename>
<name>APM Test</name>
<initialWindow>
<content>[]</content>
<visible>true</visible>
<fullScreen>false</fullScreen>
<autoOrients>false</autoOrients>
<renderMode>direct</renderMode>
</initialWindow>
<android>
<manifestAdditions><![CDATA[<manifest android:installLocation="auto" >
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="30"/>
<!-- Required permission for App measurement to run. -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE"/>
<!-- Required by older versions of Google Play services to create IID tokens -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
<application android:appComponentFactory="androidx.core.app.CoreComponentFactory">
<provider android:name="androidx.lifecycle.ProcessLifecycleOwnerInitializer" android:authorities="air.com.apm.test.lifecycle-process" android:exported="false" android:multiprocess="true"/>
<provider android:name="androidx.startup.InitializationProvider" android:authorities="air.com.apm.test.androidx-startup" android:exported="false"/>
<receiver android:name="com.google.android.gms.measurement.AppMeasurementReceiver" android:enabled="true" android:exported="false"/>
<service android:name="com.google.android.gms.measurement.AppMeasurementService" android:enabled="true" android:exported="false"/>
<service android:name="com.google.android.gms.measurement.AppMeasurementJobService" android:enabled="true" android:exported="false" android:permission="android.permission.BIND_JOB_SERVICE"/>
<activity android:name="com.google.android.gms.common.api.GoogleApiActivity" android:exported="false" android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
<service android:name="com.google.firebase.components.ComponentDiscoveryService" android:exported="false">
<meta-data android:name="com.google.firebase.components:com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar" android:value="com.google.firebase.components.ComponentRegistrar"/>
</service>
</application>
</manifest>
]]></manifestAdditions>
<containsVideo>true</containsVideo>
</android>
<iPhone>
<InfoAdditions><![CDATA[
<key>NSUserTrackingUsageDescription</key>
<string>Allows us to deliver personalized ads for you.</string>]]></InfoAdditions>
<Entitlements><![CDATA[
]]></Entitlements>
</iPhone>
<extensions>
<extensionID>com.distriqt.IDFA</extensionID>
<extensionID>androidx.core</extensionID>
<extensionID>com.distriqt.playservices.Base</extensionID>
<extensionID>com.distriqt.playservices.AdsIdentifier</extensionID>
<extensionID>com.distriqt.Core</extensionID>
</extensions>
</application>
There will be guides for each of the major IDEs created in the future but the key points are:
- Add the
ane
directory as an extensions directory; - Add the
libs
directory as a library directory (containing swc's); - Add the
libs_src
directory as a source directory (containing source code for libraries); - Add the content in the
assets
directory as content to be packaged at the root of your application;
These are always only if they exist as they won't be created unless required by a package.
Background
Client
Development