Description of the Control
Many times we have the problem that we do not know how to go from our location to a site or between two sites, that's why Simplifica Software developed the user control SDMapView. It implements the same functions as the GeneXus SD Maps user control, it also allows to visualize different routes between two points.
Using the control
If the Grid has a single item, SDMapView will look for the route between the location of the device and the item.
If the Grid has two items, SDMapView will look for the route between the two items. The first item will be the origin and the second the destination.
The destination and origin can be exchanged in execution.
The user can select a source or destination of choice through the Google Places services.
The user can select different routes for the same origin-destination.
The user control has the same properties as SD Maps and the following:
- Google Places API Key (iOS)
- Google Places Api Key (Android)
The Google Places API uses an API key to identify the application. API keys are managed through the Google APIs console. You will need your own API key in order to start using the API. To activate the Google Places API and create a password, follow these steps (https://developers.google.com/places/web-service/get-api-key#get_an_api_key):
- Go to the API console page (https://code.google.com/apis/console) and sign in to your Google account.
- Create a new project by clicking on the Create Project button at the top of the window, enter the name of the project and select the Create option. The new project may take a few seconds to be created. Customers in the Google Maps API for Business should use the API project created for them when buying Places for Business, by selecting it from the list of projects on the screen.
- On the Api Manager / Library screen that opens when the project is created, click on the link Google Maps Android API.
- Click Enable at the top of the screen.
- Return to the Api Manager / Library screen and repeat the same steps for the Google Places API for Android, Google Maps SDK for iOS, Google Places API for iOS options.
- In the side menu select the Credentials option and then click Create Credentials, selecting the Api Key option, in the pop-up that opens below, click on the Android Key button
- On the Credentials / Create Android API key page that opens below, click on the create button. The key for Android will appear on the screen.
- Repeat the process to obtain the iOS key, clicking Create Credentials, selecting the Api Key option, in the pop-up that opens click on the iOs Key button
- Credentials may take around 5 minutes to be enabled for use.
- Location Name Attribute: The text Attribute to be displayed is assigned for the Geolocation set in Location Attribute.
Steps to define the value of the literals:
- Add an event in any of the SD panel of the application, with the following code:
&aux = "SCA_StartingPoint"
&aux = "SCA_EndPoint"
&aux = "SCA_Start"
&aux = "SCA_End"
&aux = "SCA_CurrentLocation"
&aux = "SCA_Route"
&aux = "SCA_NoRouteFound"
&aux = "SCA_CurrentLocationFailed"
&aux = "SCA_CurrentLocationFailedMsg"
- In the Folder View go to Customization \ Localization in the tab of the language or languages used, look for the literals in the Code column and enter the desired value in the Localized Text column
- In the properties of the environment, modify the Translation Type field leaving the value run-time