Chapter 3. Permissions and Configuration Settings

When creating an Android application, it is necessary to select the permissions that your application will require to operate. As noted in in Chapter 1, it is important that you only select the permissions that your application needs to operate, because the application permissions requested will be used to filter which devices can install your application from the Android Market. There are also several other configuration settings, unique to Android applications, that will be covered in this chapter.

The AIR 2.6 release includes the permission options outlined below, which can be selected within the new Flex Mobile project interface of Flash Builder 4.5. This is shown in Figure 3-1. Figure 3-2 shows the warning the user will see when installing an application with permission requests. The permissions are:

INTERNET

Allows applications to open sockets and embed HTML content.

WRITE_EXTERNAL_STORAGE

Allows an application to write to external storage.

READ_PHONE_STATE

Allows the AIR Runtime to mute audio from application, in case of incoming call.

ACCESS_FINE_LOCATION

Allows an application to access GPS location.

DISABLE_KEYGUARD, WAKE_LOCK

Allows applications to access screen dimming provision.

CAMERA

Allows applications to access device camera.

RECORD_AUDIO

Allows applications to access device microphone.

ACCESS_NETWORK_STATE, ACCESS_WIFI_STATE

Allows applications to access information about network interfaces associated with the device.

These permissions are also editable within the application’s XML configuration file.

Here is a sample of what that looks like:

<android>
    <manifestAdditions><![CDATA[
          <manifest installLocation="auto">
          <!--See the Adobe AIR documentation for more information about setting
              Google Android permissions-->
          <!--Removing the permission android.permission.INTERNET will have the 
              side effect of preventing you from debugging your application 
              on your device-->
          <uses-permission name="android.permission.INTERNET"/>
          <!--<uses-permission name="android.permission.WRITE_EXTERNAL_STORAGE"/>-->
          <!--<uses-permission name="android.permission.READ_PHONE_STATE"/>-->
          <!--<uses-permission name="android.permission.ACCESS_FINE_LOCATION"/>-->
          <!--The DISABLE_KEYGUARD and WAKE_LOCK permissions should be toggled 
              together in order to access AIR's SystemIdleMode APIs-->
          <!--<uses-permission name="android.permission.DISABLE_KEYGUARD"/>-->
          <!--<uses-permission name="android.permission.WAKE_LOCK"/>-->
          <!--<uses-permission name="android.permission.CAMERA"/>-->
          <!--<uses-permission name="android.permission.RECORD_AUDIO"/>-->
          <!--The ACCESS_NETWORK_STATE and ACCESS_WIFI_STATE permissions should be 
              toggled together in order to use AIR's NetworkInfo APIs-->
          <!--<uses-permission name="android.permission.ACCESS_NETWORK_STATE"/>-->
          <!--<uses-permission name="android.permission.ACCESS_WIFI_STATE"/>-->
    </manifest>

    ]]></manifestAdditions>
</android>