riaxe snippets
Posts tagged Mobile
Run Flex/AIR Mobile app in the background
Feb 11th
Running a Flex Mobile application in the background for iOS and Android is explained below as per adobe:
iOS background behavior [Not Supported]
On iOS, applications are not permitted to run in the background in a generic fashion. Instead, they must declare that they want to perform a certain type of background processing, such as keeping a voice-over-IP call going or completing a pending upload.
AIR does not provide support for this iOS background processing model, so when they are sent to the background, AIR apps are simply paused. Their framerate goes to zero, no events are dispatched, and no rendering occurs. They do, however, stay resident in memory by default. This allows the application to preserve its state when brought back to the foreground.
Android background behavior [Partially Supported]
On Android, applications are encouraged to do as little as possible in the background but do not have severe restrictions imposed. When an AIR application is sent to the background on Android, its animation framerate is reduced to four frames per second and, although all events continue to be dispatched, the rendering phase of the event loop is skipped.
AIR apps on Android therefore can continue to perform background tasks, such as completing an upload or download operation, or periodically syncing information. However, applications should take steps to further reduce their framerate, turn off or reduce other timers, and so on, when in the background.
Reference: http://www.adobe.com/devnet/air/articles/considerations-air-apps-mobile.html
APN using Flex Mobile in Windows – Native Extensions – iOS Build Issues [Solved]
Feb 10th
Its always difficult developing iOS apps on Windows as we don’t have access to the native stuff. While using Native Extensions for iOS devices we often miss-configure the application xml.
I used the example application for using Apple Push Notifications mentioned here – http://flashsimulations.com/2011/12/16/apple-push-notification-service-native-extension-for-adobe-air/
We need to follow the following steps in order to use Native Extensions for iOS on Windows using Flash Builder 4.6 and AIR 3.1:
- We need to add the app id configured in apple’s developer portal.
<!– A universally unique application identifier. Must be unique across all AIR applications.
Using a reverse DNS-style name as the id is recommended. (Eg. com.example.ExampleApplication.) Required. –>
<id>com.riaxe.testapp</id>
- We need to copy the Entitlements present in the pList file from the mobileprovision file
We can get the Entitlements from the mobileprovision file that we use. We can get the mobileprovision file from the apple’s developer portal.
We can copy the XML from the file under Entitlements section.
<key>Entitlements</key>
<dict>
<key>application-identifier</key>
<string>LACP5QKG47.com.riaxe.testapp</string>
<key>get-task-allow</key>
<true/>
<key>keychain-access-groups</key>
<array>
<string>LACP5QKG47.*</string>
</array>
</dict>
- We need to add the Entitlements XML structure onto the Application XML
<iPhone>
<Entitlements>
<![CDATA[
<key>application-identifier</key>
<string>LACP5WER47.com.riaxe.testapp</string>
<key>get-task-allow</key>
<true/>
<key>keychain-access-groups</key>
<array>
<string>LACP5WER47.*</string>
</array>
]]>
</Entitlements>
<InfoAdditions><![CDATA[
<key>UIDeviceFamily</key>
<array>
<string>1</string>
<string>2</string>
</array>
]]></InfoAdditions>
<requestedDisplayResolution>high</requestedDisplayResolution>
</iPhone>
Done!!! This would definitely fix build issues in Flash Builder 4.6 for iOS devices.