Lionel (and Jude),

Thanks for getting back to me...I am using AMF via RemoteObject and
ColdFusion...and it is pretty wicked fast.

While lots of RemoteObject calls are no problem on a desktop, it seems to be
on mobile...especially, as one would expect, when the signal is very weak.

Maybe what I could do in the short term (my Googling is leading to the
conclusion that loading everything down to a SQLite database and syncing,
while the best approach, is something I should try and avoid for now) is
load everything into ArrayCollections and Filter them as needed...syncing as

I am able to behind the scenes.  Pretty sure I should be able to Filter the
ArrayCollections...on foreign keys...should be just like Querying the
database, once all the records are loaded the first time.

This leads to few initial questions:

1. How do I keep the app from closing once it loses focus?
2. What will be the impact of #1 on battery life?
3. Does Air/Flex drain much battery power when not showing anything?  
4. Does Air/Flex know to conserve power when in the background or is that
something I have to program?

Thanks for the feedback,

Mark



-----Original Message-----
From: Lionel A. Pierre [mailto:[email protected]] 
Sent: Thursday, June 27, 2013 10:40 AM
To: [email protected]
Subject: Re: Guidance needed

I agree with Jude on the AMF, I was gonna suggest the same thing. Sometimes
if bandwidth is a real problem, you can benefit from adding a PHP layer
between whatever server you are targeting and your mobile app just to get
AMF. I've done a huge mobile app in the past using that technique, and never
got complaints about connectivity though it was almost exclusively used
outside.

>From a user standpoint, always show the busy indicator when the app is
talking to the server, let the user know something is going on, that also
makes a difference.

For every view, optimize your calls, only get what you need, and only send
up what has changed.

Good luck.

*Lionel*

On Thu, Jun 27, 2013 at 5:07 AM, jude <[email protected]> wrote:

> Hi Mark,
>
> Is it limited to bandwidth issues? Can you save and reuse a local copy 
> of the array collection (s) before going with a local database? I 
> haven't had to sync to databases before so I'll leave that to someone 
> else but for the other areas if they have to do with the array 
> collections, there's a couple of things you can to improve 
> performance, most of which I'm sure you are already aware of.
>
> If you know or can limit the query to the server to get only the 
> records that have changed since the last sync and you've already 
> populated the array collection then once you get those records you can 
> iterate over them and call itemUpdated if they already exist.
>
> // loop through and find the items that need updating var item = 
> collection.findItemByID(id); // find the items that changed // call 
> item updated on each filteredCollection.itemUpdated(itemThatChanged, 
> "@value");
>
> // when you're done call refresh
> filteredCollection.refresh();
>
>
> If you are updating a lot of items or if those items use databinding 
> then you can disable auto update :
>
> filteredCollection.disableAutoUpdate();
>
> // update items in the collection
>
> filteredCollection.enableAutoUpdate();
>
> When using removeAll() on an array collection can be slow sometimes. 
> This is because it is has to remove any listeners added through 
> databinding. See this [1]. If you are using databinding in item 
> renderers substitute each binding with direct assignments in the set data
function.
>
> So do this:
>
>             override public function set data(item:Object):void {
>                 super.data = item;
>                 if (labelDisplay && item) labelDisplay.text = 
> item.property;
>
> instead of this:
>
> <s:Label text="{data.property}" />
>
> Use AMF when sending data back and forth between the server. JSON data 
> might be faster and more compact than XML. I think you said you're 
> sending remote objects already.
>
>
> [1]
>
> http://stackoverflow.com/questions/5286326/flex-arraycollection-remove
> all-vs-new-arraycollection
>
> On Mon, Jun 24, 2013 at 1:49 PM, Mark Fuqua <[email protected]> wrote:
>
> > I am looking for some architectural guidance.
> >
> >
> >
> > I developed a mobile application using Flex mobile.  It is not very
> usable.
> > This is no fault of Flex, it is the way I designed it.  The 
> > application
> is
> > a
> > task management application with lots of data exchange with a remote 
> > server.
> >
> >
> >
> >
> > During development, it worked OK.some forms were slow to get 
> > required
> data,
> > but all in all, being a business application with a captive 
> > audience, it was usable.  However, during real world testing, it was 
> > obviously deficient, especially in areas with a weak signal.  It is 
> > not usable in its present form.
> >
> >
> >
> > I have two main issues.the first is, I need to run the application 
> > with a local sqlite database and synch in the background.  I really 
> > don't know
> the
> > right way to do this.  But I am thinking the steps are something 
> > like the
> > following:
> >
> >
> >
> > 1.            Add two columns to the required database tables:
> > CreatedTimeStamp and MostRecentEditTimeStamp
> >
> > 2.            Write a script that creates a blank database when the app
> is
> > initially run, which matches the database tables required on the 
> > remote database (about 15 tables).  Most of the remote tables have
> auto-increment
> > primary keys, so I guess just numeric primary key on the phone.
> >
> > 3.            Connect to the database and create ArrayCollections for
> each
> > of the database tables.
> >
> > 4.            Loop over theArrayCollections and add the data to the
> SQLite
> > database tables.
> >
> > 5.            Then, as the user works with the application, change all
my
> > remote objects to SQLite queries populating the existing
> ArrayCollections,
> > for the existing forms and lists, which should eliminate the 
> > remoteObject latency/failures that plague the current version.
> >
> > 6.            Change all the add/edit functions to include added/edited
> > timestamps (to the CreatedTimeStamp and MostRecentEditTimeStamp 
> > columns mentioned above).
> >
> > 7.            When the sync occurs, download all newly added records
from
> > the various tables ( I guess in an order that doesn't violate 
> > foreign key constraints).
> >
> > 8.            Upload any newly created records from the phone to the
> remote
> > database.
> >
> > 9.            Download any edited records changed since last sync to the
> > phone.
> >
> > 10.          Upload any edited records changed on the phone since the
> last
> > sync.
> >
> >
> >
> > I am not even going to mention the second issue just yet.this is the 
> > big one and quite a stretch for a hack like me.
> >
> >
> >
> > Any guidance, advice, or shortcuts would be greatly appreciated.
> >
> >
> >
> > Mark Fuqua
> >
> >
> >
> > [email protected]
> >
> >
> >
> > 2301 Mount Carmel Road
> >
> > Parkton,  MD  21120
> >
> > (410) 215-7356
> >
> >
> >
> > www.availdata.com
> >
> >
> >
> >
>


Reply via email to