Let me describe ADF Mobile application with Google Maps and GPS support. I have implemented this application in few hours, installed on my iPhone and ready to travel - I will not be lost. So, I would like to share source code with you - you can compile and install it on iPhone, iPad or Android.
Main features currently available:
1. Google Maps embedded using ADF Mobile Geographical Map component (8.5.14 How to Create a Geographic Map Component)
2. GPS location update (9.5.8 How to Use the startLocationMonitor Method)
3. GPS location point display
If I will have time, I plan to implement dynamic GPS location point moving on the map as you go and synchronization with on device database. You can download source code for the current version from here - ADFMobileGoogleMaps.zip.
Here is the home screen - Google Maps. Screenshots are taken directly from my iPhone:
User have two options - Reset and Position. I have noticed that sometimes, especially when network connectivity is lost - ADF Mobile application with Maps component may get unresponsive. This is the reason for Reset button - it performs logout and resets application state. Position - it flips Maps display and open GPS control view:
In this screen you can press Start and synchronize Latitude/Longitude for your current position from GPS satellite. Synchronization may take a bit of time, while it becomes accurate - this is the reason for Stop button (to stop synchronization period):
Once position is located, press Back and Google Maps will flip back with a zoom into your position displayed on the map (my real location is displayed here :):
I will walk you know through the technical things. This application contains ADF Task Flow and navigation between Google Maps page and GPS control:
The way how pages are opened on the device (slide, flip) is control by ADF Task Flow navigation case. I have set page transition behavior to be flipLeft:
Google Maps embedded using ADF Mobile Geographical Map component. It sets various properties, such as center, map type, zoom level. ADF Mobile Geographical Map is able to render data layers on top:
My application, renders single point - current position. Position is retrieved from custom bean Data Control (I have defined it myself):
Drag and drop this Data Control on top of ADF Mobile Geographic Map component, JDeveloper generates point data layer automatically from the wizard:
There is getPositions() method responsible to get data about retrieved position (initialized from custom GoogleMapsBean):
GPS action is triggered on the device and data is retrieved using built in ADF Mobile Data Control - Device Features. There is designated method available - startLocationMonitor(boolean, int, String):
GPS method is invoked from the Start button:
One of the parameters - locationListener, it points to the custom listener method. Listener is invoked each time, when GPS position synchronization happens (there is no need to use EL brackets) - method name is static text:
When position is retrieved from GPS and synchronization is stopped - custom Position bean is updated with X/Y:
There is one interesting specific thing related to ADF Mobile - value refresh on the UI. If value is changed in the background, we want to display new value on the UI (but there are no Auto Submit and Partial Triggers in ADF Mobile). Updated value is refreshed on UI using property change support listener invocation from the setter:
Property change support listener declaration:
Main features currently available:
1. Google Maps embedded using ADF Mobile Geographical Map component (8.5.14 How to Create a Geographic Map Component)
2. GPS location update (9.5.8 How to Use the startLocationMonitor Method)
3. GPS location point display
If I will have time, I plan to implement dynamic GPS location point moving on the map as you go and synchronization with on device database. You can download source code for the current version from here - ADFMobileGoogleMaps.zip.
Here is the home screen - Google Maps. Screenshots are taken directly from my iPhone:
User have two options - Reset and Position. I have noticed that sometimes, especially when network connectivity is lost - ADF Mobile application with Maps component may get unresponsive. This is the reason for Reset button - it performs logout and resets application state. Position - it flips Maps display and open GPS control view:
In this screen you can press Start and synchronize Latitude/Longitude for your current position from GPS satellite. Synchronization may take a bit of time, while it becomes accurate - this is the reason for Stop button (to stop synchronization period):
Once position is located, press Back and Google Maps will flip back with a zoom into your position displayed on the map (my real location is displayed here :):
I will walk you know through the technical things. This application contains ADF Task Flow and navigation between Google Maps page and GPS control:
The way how pages are opened on the device (slide, flip) is control by ADF Task Flow navigation case. I have set page transition behavior to be flipLeft:
Google Maps embedded using ADF Mobile Geographical Map component. It sets various properties, such as center, map type, zoom level. ADF Mobile Geographical Map is able to render data layers on top:
My application, renders single point - current position. Position is retrieved from custom bean Data Control (I have defined it myself):
Drag and drop this Data Control on top of ADF Mobile Geographic Map component, JDeveloper generates point data layer automatically from the wizard:
There is getPositions() method responsible to get data about retrieved position (initialized from custom GoogleMapsBean):
GPS action is triggered on the device and data is retrieved using built in ADF Mobile Data Control - Device Features. There is designated method available - startLocationMonitor(boolean, int, String):
GPS method is invoked from the Start button:
One of the parameters - locationListener, it points to the custom listener method. Listener is invoked each time, when GPS position synchronization happens (there is no need to use EL brackets) - method name is static text:
When position is retrieved from GPS and synchronization is stopped - custom Position bean is updated with X/Y:
There is one interesting specific thing related to ADF Mobile - value refresh on the UI. If value is changed in the background, we want to display new value on the UI (but there are no Auto Submit and Partial Triggers in ADF Mobile). Updated value is refreshed on UI using property change support listener invocation from the setter:
Property change support listener declaration: