Controlling Distribution by Using the MAC Address

You may need to develop an application that is only authorized to run on some devices. You could upload it to a server and give the URL to a selected group, but this method is not very secure.

To monitor installation, use the MAC address of the device. The MAC address is the unique identifier for the hardware, mobile device, or desktop.

First, set the Android permissions to have access to network information:

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

To obtain the address at runtime, use the NetworkInfo class, which gets a list of interfaces and looks for a hardwareAddress. It is the MAC address for your device:

if (NetworkInfo.isSupported) {
trace(“network information is supported”);
}
var network:NetworkInfo = NetworkInfo.networkInfo;
for each (var object:NetworkInterface in network.findInterfaces()) {
if (object.hardwareAddress) {
trace(object.hardwareAddress);
}
}

The address looks something like this:

00:23:76:BB:46:AA.

Launching an AIR Application

The first time a user launches an AIR application, the Adobe AIR license agreement will appear. The user only needs to agree to the terms once.

If you are familiar with developing AIR applications on the desktop, you may have noticed a difference here. The installation warning dialog does not appear on the device. The messaging is handled by the operating system when the application is installed, as it is for native Android applications. Also, downloaded applications are stored in the /data/app directory which is a private directory.

 


Posted

in

by

Tags: