Avatar

Level 2

Thank you so much for your answer! Really apreseate it!

It helped me a long way and i'm now capable of creating LCDS driven AIR apps.

Only problem though with the Mobile section. Did everything by the book but the list is still not getting populated.. The code:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:test7="test7.*"
               preinitialize="app_preinitializeHandler(event)"
               creationComplete="windowedapplication1_creationCompleteHandler(event)"
               applicationDPI="160">
    <fx:Script>
        <![CDATA[
           
            import com.adobe.offline.ProductOfflineAdapter;
           
            import mx.events.FlexEvent;
            import mx.messaging.Channel;
            import mx.messaging.ChannelSet;
            import mx.messaging.channels.RTMPChannel;
            import mx.messaging.events.ChannelEvent;
            import mx.rpc.AsyncToken;
            import mx.rpc.events.FaultEvent;
            import mx.rpc.events.ResultEvent;
           
            public var myOfflineAdapter:ProductOfflineAdapter;
            public function channelConnectHandler(event:ChannelEvent):void
            {
                productService.serviceControl.autoConnect=false;
               
            }
            protected function 
                app_preinitializeHandler(event:FlexEvent):void
            {
                var cs:ChannelSet = new ChannelSet();
                var customChannel:Channel = new RTMPChannel("my-rtmp",
                    "rtmp://localhost:2037");
                cs.addChannel(customChannel);
                productService.serviceControl.channelSet=cs;
                customChannel.addEventListener(ChannelEvent.CONNECT,
                    channelConnectHandler);
            }
           
            protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
            {
                getAllResult.token = productService.getAll();
            }
           
            protected function
                windowedapplication1_creationCompleteHandler(event:FlexEvent):void
            {
                productService.serviceControl.autoCommit = false;
                productService.serviceControl.autoConnect = false;
                productService.serviceControl.autoSaveCache = false;
                productService.serviceControl.offlineAdapter = new
                    ProductOfflineAdapter();
                productService.serviceControl.fallBackToLocalFill=true;
                productService.serviceControl.encryptLocalCache = true;
                productService.serviceControl.cacheID = "myOfflineCache";
            }
           
            protected function list_creationCompleteHandler(event:FlexEvent):void
            {
                getAllResult.token = productService.getAll();
            }
           
        ]]>
    </fx:Script>
    <fx:Declarations>
        <s:CallResponder id="getAllResult"/>
        <test7:ProductService id="productService"/>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <s:List id="list" x="10" y="10" creationComplete="list_creationCompleteHandler(event)"
            labelField="productname">
        <s:AsyncListView list="{getAllResult.lastResult}"/>
    </s:List>
</s:Application>

It is just a simple list component that needs to be filled, in this case by the LCDS sample database. When I monitor the network connections, the trigger is running succesfully with the following output:

ServiceRequest: trigger connect; MessageService; trigger connect
(mx.messaging.messages::CommandMessage)
  body=(Object)#0
  clientId=(null)
  correlationId=""
  destination="test7.Product"
  headers=(Object)#0
  messageId="28C54E63-357A-6ACF-B9FD-C0889B6115E9"

Status: OK

But there is no Fill execution. When I run this code in an AIR desktop application all runs smooth. Air starts -> connection trigger OK -> Fill execution OK -> And i have a lovely list component filled with Data. When I run this in a mobile app the connection trigger is OK but the fill is not executed.

Can you help? If you need any further information, just let me know!

thx!