Add the Extension

First step is always to add the extension to your development environment. To do this use the tutorial located here.

Dependencies

Many of our extensions use some common libraries, for example, the Android Support libraries.

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.

You will add these extensions as you do with any other extension, and you need to ensure it is packaged with your application.

Core

The Core ANE is required by this ANE. You must include and package this extension in your application.

The Core ANE doesn't provide any functionality in itself but provides support libraries and frameworks used by our extensions. It also includes some centralised code for some common actions that can cause issues if they are implemented in each individual extension.

You can access this extension here: https://github.com/distriqt/ANE-Core.

Extension IDs

The following should be added to your extensions node in your application descriptor to identify all the required ANEs in your application:

<extensions>
<extensionID>com.distriqt.NetworkInfo</extensionID>
<extensionID>com.distriqt.Core</extensionID>
</extensions>

Android

Manifest additions

Depending on the functionality you will be using in your application you may require the following permissions added to your manifest additions in your application descriptor:

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

MultiDex Applications

If you have a large application and are supporting Android 4.x then you will need to ensure you enable your application to correctly support MultiDex to allow the application to be broken up into smaller dex packages.

This is enabled by default with releases of AIR v25+, except in the Android 4.x case where you need to change the manifest additions for the application tag to match the following and use the MultiDexApplication.

Using AndroidX

This will require the addition of the androidx.multidex extension which contains the androidx.multidex.MultiDexApplication implementation.

<manifest android:installLocation="auto">
<!-- PERMISSIONS -->
<application android:name="androidx.multidex.MultiDexApplication">
<!-- ACTIVITIES / RECEIVERS / SERVICES -->
</application>
</manifest>

Checking for Support

You can use the isSupported flag to determine if this extension is supported on the current platform and device.

This allows you to react to whether the functionality is available on the device and provide an alternative solution if not.

if (NetworkInfo.isSupported)
{
// Functionality here
}