Page 1 of 1

aXes Mobile - How to add a button to use the Geolocation

Posted: 08 Aug 2014, 16:16
by jeanmichel
How to add a button to a project to use the mobile device's Geolocation feature

1) Open aXes development environment

Image

2) Load your project in TS2 and navigate to the screen you wish to customise

Click on "Work as a TS2 Developer"

Image

Signon to your session

Image

Type on the command line: "addlible axesdemo" followed by enter

Image

Type on the command line: "call xhrrpgtrn" followed by enter

Image

Put an X next to to an employee

Image

If you don't have a screen definition, press suggest and save the screen.

Image

3) Add a PushButton

Image

4) Edit caption. Change the caption value to "Take me there"

Image

5) Click on the tab "screens"

Please note: This script uses the values of the fields Street, City, State, Country and these names need to be defined in the screens tab of TS2 development environment for the relevant fields.
Change the fields' names to:
Street
City
State
Zip
Country

Image

6) Edit script

Copy and paste the script hereunder in the edit box.

Image

Code: Select all

if (window.LRSV)
{
   var callBackFunction = function(result)
   {
   var url = "http://www.google.com/maps/dir/" + 
   result.userInfo.LATITUDE + "," + 
   result.userInfo.LONGITUDE + "/+" + 
   FIELDS("Street").getValue().replace(" ","+") + ",+" + 
   FIELDS("City").getValue().replace(" ","+") + ",+" + 
   FIELDS("State").getValue().replace(" ","+") + ",+" + 
   FIELDS("Country").getValue().replace(" ","+");
   window.open( url );
};
var options =
{
callBack : callBackFunction
};
LRSV.getGeolocation( options );
}
7) You should now have a button on your screen which looks like this:

Image

8) open aXes mobile and run your demonstration

Image Image Image