Hey, need some help regarding how to handle data services for sub-apps within an AIR application. Posted this here because I'm using the Flex 4 framework, but if you think I'll get a better answer somewhere else, please let me know.
Basically, what I want to achieve is that I can define services in sub-apps, but have an AIR wrapper implement local storage for services if a network connection is not present. Ideally, the sub-apps should not need to care if they're running within AIR or the Flash player.
The application has the following loading structure:
Core and sub-apps are loaded using loadForCompatibility=true, meaning they're in sibling application domains.
Roughly put, the following flow is what I would like to achieve:
1. A sub-app sends some data to a PHP service (using RemoteObjects).
2. The AIR wrapper for the sub-app checks if a network connection is available for that service
2a. If yes, the data is sent to the service right away
2b. If no, the AIR wrapper stores the data locally instead and sends it to the service the next time it becomes available
3. Either way, the sub-app gets a success message, with the added detail of where the data got saved (either locally or to the sevice)
What I would like to avoid is having to compile the implementing classes of each service that a sub-app might need into the AIR wrapper, because the goal is that I should be able to add sub-apps to the platform without having to re-compile the wrapper.
Does anyone have any suggestions on how to solve this? Are there other ways of going at this problem?
A while ago I did something similar with Flex3(can't see any reason why it shouldn't work with 4). I used a local sqllite database to mimic the online db and populated that db if the app failed an online validation test. Each time the App was started I checked the status of the localdb and moved the data to the server if there was a valid remoteobject connection. I remember one of the adobe guys actually wrote some syncronisation classes for Air sqllite and a remote db, ff I can find it I will post the link.
If you can find the links that would be great, thanks!
Currently I'm considering a solution where I would boot strap all services in separate modules and then load those with the wrapper. The actual sub-apps would just call abstract classes which depending on the type of runtime would get either the AIR implementation or a generic implementation... But still means I'd have to update the services modules each time a new sub-app is added... Benefit of course would be that more than one sub-app could use the same service implementations... Don't know, just brainstorming here. Any ideas are welcome