#4 WoOF as Android App


As OfficeFloor (including the WoOF plugins) do not use any special Java functionality and does not rely on any third party libraries, it should happily be able to be compiled to run on Android.

This would allow building Android Apps with WoOF. Ideally a WebView would wrap WoOF running on the phone, so that both the WebView and WoOF would be managed appropriately for the Activity lifecycle.

For hints on building:
1) Use WoofOfficeFloorSource to start and stop the web application inside the appropriate Activicy lifecycle methods
2) Provide WoofOfficeFloorSource a ResourceSource that uses the AssetManager to retrieve all the necessary static resources.
3) Run WoofOfficeFloorSource on a particular port so the WebView can talk directly to the port. Might need to add restriction to only serve data to localhost (OfficeFloor team happy to assist in providing this functionality). Reason for running WebView against port explained later.
4) Provide an implementation of net.officefloor.plugin.web.http.session.spi.HttpSessionStore that persists the session state within the appropriate Activity lifecycle (I believe the onPause is the appropriate method)
5) Provide a maven plugin to setup an existing WoOF war to be compiled as an Android App (i.e. unpacks the war and copies the contents to the appropriate src and asset directories). May then use android-maven-plugin to build the Android App. This would mean that able to take an existing WoOF application and "just" compile it for Android (though might need to tweak some dependency configuration - e.g. change SQL driver information)

Reason for running WebView against port is that it will provide the application owner a nice migration path to buliding out a back end. Initially WoOF can run locally on the Android phone requiring no upfront hosting costs. Once there is interest in the app, the owner can then provide an updated version of their Android App that points to OfficeFloor hosted in the cloud (rather than locally). This might be a compile option for generating the Android App in step 5 above. As OfficeFloor can run in both environments, the app owner can make the transition when ready with minimal (if any) code changes. The users of the app will notice little difference in usage (except some possible unavoidable slowness due to network when introducing a back end).

This is a nice model as application owners only pay more after they are recieving more. It also allows the application owner to scale out rapidly if necessary.