I'm very new to AIR. I'm very interested in learning it. I
would like to ask one question before learning.
Is it possible to use AIR to develop Offline/Online
application? What I mean by Offline/Online application is that the
application work on offline when the network is down. If the
network is available then it will automatically re-connect with
online services and will sync the offline data to the online
Here is one scenario.
Let's say I have a small application called "Student
Registration Management" system. I have StudentRegistration.UI
(AIR)project and StudentRegistrationService Web Service project.
StudentRegistration.UI project is working fine as long as we have
the network connection. But the problem is that our network
connection is not so stable. sometimes, it used to disconnect for
half-day and etc . So, we are considering to make our project work
In order to do that, we are thinking to add another layer
that can switch the proxy class and offline class that can access
to the local database.
StudentRegistration.UI --> [detect the connection] ->
[if online] call Proxy to invoke the webservice.
-> [if offline] call another class that can connect to
the local database which is located under "My Document" or
Q1. Do you think this is the correct approach??
Q2. Is it possible to connect the MS access database or mdf
from AIR directly? (Note: This MS Access Database or mdf will be
located under under "My Document" or "somewhere" ) If yes, how can
I do that? Do I have to use the "inline" SQL statement too?
Q3. Having one layer that can connect with local database
will add the duplicated effort. Whenever we changed something in
StudentRegistrationService Web service project, we will need to do
the same thing for those offline classes. How can I reduct this
You can definitely built apps with online-offline
capabilities with AIR. You can't connect to an MS Access database,
but AIR has built-in SQLite (a file based DB like MS access) DB
support. Use SQLite to persist data when in offline mode.
The NativeApplication class whose singleton instance can be
accessed via NativeApplication.nativeApplication dispatches an
event (networkChange) whenever any change in the network is
detected. It may be a connection coming back up or a connection
going down. Your application has to listen to this event and then
ping your server URL to see if it is online or offline. By ping,
the meaning here is only a check to see if a particular URL is
accessible using HTTP. There is an AIR class called URLMonitor used
As far as Q3 goes, you'll have redo the changes you did in
your web services classes in the local version as well. I don't see
a way around that.