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:
Great Work!. Planning to Move toward ADF mobile soon !
ReplyDeleteGreat stuff Andrejus, as usual!
ReplyDeleteJust a quick questions. Does the geographicMap component support user selection on a map (not take position based on GPS current position but based on user selection).
Hi Antonis,
ReplyDeleteYes - is possible to select point of interest on the map. If it is possible just to select anywhere on the map and retrieve coordinates - I wasn't testing this yet, but most likely no (from the current functionality I saw).
Andrejus
Hi Andrejus,
ReplyDeleteI'm little confused with above answer yes in start or no in end. Can you please confirm if it is possible to capture coordinates based on user selection on the map?
Thank you,
VJ
I'm saying - you can select point of interest, but I'm not sure if you can get coordinates just of any click on the map.
ReplyDeleteAndrejus
Hey Andrejus, Have you had any luck with Oracle Maps viewer ie., http://elocation.oracle.com/mapviewer/.
ReplyDeleteThanks
Srini
I wasnt testing with Oracle Maps, but it should work I assume.
ReplyDeleteAndrejus
It is available for free, you should check on Google site.
ReplyDeleteAndrejus
andrejus good job but how can i deploy this app to adnriod
ReplyDeleteHi Andrejus,
ReplyDeleteMy map flickers (actually makes a full-refresh) upon each position change. However the expectation is the only marker should be relocated. Do you observe the same issue?
Thanks,
Hi Andrejus,
ReplyDeleteI have implemented map using your tutorial. I have got a requirement to get the user selection. I could see that there is a selectionListener for the pointDataLayer, but I'm getting null value when I view the bindings from my bean.
Do you have any idea on how to get the selected co-ordinates/location?
Regards
Sumesh
Hi Andrejus,
ReplyDeleteJust a quick question Does the oracle MAF has the capability to set a threshold accuracy for GPS location(like when the accuracy is 5.0m or less then store the coordinate)? or do you have any idea about that..
Thanks
Yes, if I correctly remember - you can see accuracy.
ReplyDeleteAndrejus
Hi,
ReplyDeleteIt is possible to open google map navigator for display destination path in maf. how it can be done.
Thanks
Hi,
ReplyDeleteCould you re-upload the project because I can't download it.
Thanks.