Set iOS app properties with air

Source: Internet
Author: User
  • Supports background tasks on iOS
  • Reserved IOS infoadditions settings
  • Different iOS device models are supported.
  • High-resolution display
  • IOS custom URI Scheme
  • IOS compatibility Filtering
  • Exit rather than pause

The settings that apply only to iOS devices will be placed in the application Descriptor<IPhone>Element.IPhoneElement canInfoadditionsElement,RequesteddisplayresolutionElement andEntitlementsElement as a child level.

Exploitation InfoadditionsYou can specify the key-value pairs in the info. plist setting file of the application. For example, the following values set the status bar style of the application and declare that the application does not require permanent Wi-Fi access.

<InfoAdditions>    <![CDATA[        <key>UIStatusBarStyle</key>        <string>UIStatusBarStyleBlackOpaque</string>        <key>UIRequiresPersistentWiFi</key>        <string>NO</string>    ]]></InfoAdditions>

The infoadditions settings are included inCDATAMarking.

ExploitationEntitlementsYou can specify the key-value pairs of the entitlements. plist setting file to be added to the application. Entitlements. plist settings enable applications to access certain IOS functions, such as push notifications.

For more information about settings of info. plist and entitlements. plist, see the apple developer documentation.

 

Supports background tasks on iOS

Adobe AIR 3.3 and later support Multitasking on IOS by enabling certain background behaviors:

  • Audio
  • Location update
  • Network
  • Disable background Application Execution
Background audio

To enable background audio playback and recording, goInfoadditionsThe element includes the following key-value pairs:

<InfoAdditions>    <![CDATA[       <key>UIBackgroundModes</key>           <array>               <string>audio</string>            </array>    ]]></InfoAdditions>
Background location update

To enable background location update, goInfoadditionsThe element includes the following key-value pairs:

<InfoAdditions>    <![CDATA[        <key>UIBackgroundModes</key>        <array>               <string>location</string>         </array>    ]]></InfoAdditions>
Note: this function is used only when necessary because the location API consumes a lot of battery power. Background Network

To perform Short tasks in the background, your application willNativeapplication.nativeapplication.exe cuteinbackgroundSet propertyTrue.

For example, your application may start file upload, and then the user moves another application to the foreground. When the application receives an upload completion event, it canNativeapplication.nativeapplication.exe cuteinbackgroundSetFalse.

SetNativeapplication.nativeapplication.exe cuteinbackgroundSet propertyTrueThere is no guarantee that the application will run indefinitely because IOS imposes a time limit on background tasks. When IOS stops background processing, air will scheduleNativeapplication. SuspendEvent.

Disable background execution

Your application canInfoadditionsThe following key-value pairs are included in the element, which explicitly disables background execution:

<InfoAdditions>    <![CDATA[       <key>UIApplicationExitsOnSuspend</key>       <true/>    ]]></InfoAdditions>
 

Reserved IOS infoadditions settings

Air sets multiple entries in the generated info. plist file to ensure that the application and runtime functions run correctly. You cannot define the following settings:

Cfbundledisplayname

Cfbundleexecutable

Cfbundleiconfiles

Cfbundleidentifier

Cfbundleinfodictionaryversion

Cfbundlepackagetype

Cfbundleresourcespecification

Cfbundleappsversionstring

Cfbundlesupportedplatforms

Cfbundleversion

Ctautoorients

Ctinitialwindowtitle

Ctinitialwindowvisible

Ctiossdkversion

Ctmaxswfmajorversion

Dtplatformname

Dtsdkname

Minimumosversion (available in air 3.3 and later)

Nsmainnibfile

Uiinterfaceorientation

Uistatusbarhidden

Uisupportedinterfaceorientations

 

Different iOS device models are supported.

To support iPad, SetInfoadditionsElementUidevicefamilyAdd the correct key value settings.UidevicefamilyIs a string array. Each string defines a supported device.<String> 1 </string>Define the support for iPhone and iPod Touch.<String> 2 </string>Set the support for iPad. If only one string is specified, only the device series is supported. For example
IPad support:

<key>UIDeviceFamily</key>    <array>        <string>2</string>    </array>>

The following settings support two device series (iPhone/iPod Touch and iPad ):

<key>UIDeviceFamily</key><array>    <string>1</string>    <string>2</string></array>
 

High-resolution display

ExploitationRequesteddisplayresolutionElement, which can be specified on iOS devices with high-resolution screens.StandardResolution mode should still be usedHighResolution mode.

<requestedDisplayResolution>high</requestedDisplayResolution>

In high resolution mode, you can process each pixel individually on a high resolution display. In standard mode, the device screen displays the application at standard resolution. Painting a single pixel in this mode sets the color of Four pixels on the high-resolution screen.

The default value isStandard. Please note that,RequesteddisplayresolutionElement isIPhoneElement (insteadInfoadditionsElement.

 

IOS custom URI Scheme

You can register a custom URI scheme to allow your applications to be called by links on the web page or other local applications on the device. To register the URI scheme, add the cfbundleurltypes key to the infoadditions element. The following example registersCom. example. appTo allow the applicationExample: // fooURL.

<key>CFBundleURLTypes</key><array>    <dict>         <key>CFBundleURLSchemes</key>        <array>            <string>example</string>        </array>        <key>CFBundleURLName</key>        <string>com.example.app</string>    </dict></array>

When an application is called using a custom Uri, The nativeapplication object schedulesInvokeEvent. The URL of this link (including query parameters) is placed inArgumentsArray. You can use any number of custom URI schemes.

Note: The link in the stagewebview instance cannot open the URL using the custom URI scheme. NOTE: If another application has registered a scheme, your application cannot replace it with the one registered for the URI scheme.

IOS compatibility Filtering

If your application can only be used on devices with specific hardware or software features, add entriesInfoadditionsElement in the uirequireddevicecapabilities array. For example, the following entry indicates that the application requires a static camera and microphone:

<key>UIRequiredDeviceCapabilities</key><array>    <string>microphone</string>    <string>still-camera</string></array>

If the device does not have the required features, the application cannot be installed. Function settings related to the air application include:

Telephony

WiFi

SMS

Still-camera

Auto-focus-camera

Front-facing-camera

Camera-flash

Video-camera

Accelerometer

Location-services

GPS

Microphone

In air 2.6 or later versionsArmv7AndOpengles-2Add to the list of required functions.

Note: you do not need to add these features to the application descriptor to allow the application to use these features. You only need to use the uirequireddevicecapabilities settings to Prevent Users From Installing applications on devices that are not working properly.

Exit rather than pause

If the user leaves the AIR application, the application enters the background and is paused. If you want to permanently exit the application rather than suspend itUiapplicationexitsonsuspendSet propertyYes:

<key>UIApplicationExitsOnSuspend</key><true/>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.