Places Data (Google)

Places Data (Google)

Places Data (Google)

Asset Version: 1.0.0
  • Version 1.0.0
Last Published: Apr 27, 2017 By: Kony Team
146 0 0 23
Quickly connect your app with Google's database of 100 million+ places across a wide range of categories.

Requirements

  • MobileFabric
 

Features

  • Preconfigured back end service that helps your app to connect with Google database instantly.
  • Facilitates to invoke services easily from Google Places and Google Maps APIs.
  • Provides secure interaction with Google services using authentic API key, generated specific to your login.
  • Easy to attain details through simple interaction directly from MobileFabric.

Prerequisites

  • A Kony account
  • Kony MobileFabric 7.3

Places Data (Google) Back End Services

Places Data (Google) is a set of readily configured integration services using which you can quickly connect your app with Google's database of 100 million+ places across a wide range of categories.

The following sections help you use the Places Data (Google) back end service in your app:

Prerequisites

Before you start using the Places Data (Google) application, ensure the following:

  1. Kony Account.
  2. Kony MobileFabric 7.3
  3. Download Places Data (Google) Integration Service from Kony Marketplace and import it to your MobileFabric.

Importing the Places Data (Google) MobileFabric App

To import the Places Data (Google) zip file, do the following:

  1. Log on to your MobileFabric Console. The Dashboard page appears by default.
  2. In the left pane, click the Apps menu. The Custom Apps tab opens by default.
    placesdata_import.png
  3. Click Import. The Import App dialog appears.
    placesdata_imported.png
  4. Drag the zip file into the Import App dialog.
  5. Alternatively, click Browse. The Open dialog appears. Navigate to the location where you downloaded the Places Data (Google) (zip file) on your computer. Select the zip file, and click Open. The zip file is selected and the Import App dialog appears as shown in the following figure.
    placesdata_browse_imported.png
  6. In the App Name box, the Places Data Google is displayed by default. You can change the name, if required.
  7. Select Import as new to create a new app. If there is an app that exists with the same name and if you want to overwrite it, click Overwrite existing app.
  8. Click Import. The Places Data Google app is listed on the Custom Apps page.
Note:

If you changed the name in the App Name box, the app with the updated name is listed on the Custom Apps page.

Generating Google Places/Maps API Keys

To use Google Services generate an API key. To generate the API key visit Google Places or Google Maps and select the appropriate service and generate a key for the selected service. Provide the Places key or the Maps key based on the type of request placed to fetch the responses.

To generate an API Key for Google places service, do the following:

  1. Log on to your Google Places. The Google Places API page appears by default.
  2. Select the required service from the left pane.
  3. In the top-right pane, click the GET A KEY button.
    placesdata_generating_key.png

    The following confirmation message along with your generated API key appears.
    placesdata_apikey.png

Testing the Existing Back End Service

Testing an operation involves making the service call by setting the necessary parameters and displaying the response. The procedure to execute any operation is same, but the request parameters of the services change.

This section provides steps to test the konympPlgetGoogleAutoComplete operation.

To execute the konympPlgetGoogleAutoComplete operation, do the following:

  1. Log on to your MobileFabric Console. The Dashboard page appears by default.
  2. In the left pane, click the Apps menu. The Apps tab opens by default.
  3. Click the Integration tab. The Integration tab opens with a list of existing integration services.
  4. From the list of integration services, select the integration service. The Service Definition tab of the selected integration service opens by default.
  5. Select the Operations List tab.
  6. Under the Configured Operations section, click the konympPlgetGoogleAutoComplete operation. The konympPlgetGoogleAutoComplete tab opens with the Request Input sub-tab opened by default.
  7. The Name box displays a default operation name. You can change the name, if required.
  8. In the Request Input tab, in the Body section, for the following mandatory parameters, specify the values in the respective boxes under the Test Value column.
    • key: Accepts string value. Google Places or Map API key.
    • input: The parameter takes strings as input and returns additional values.
  9. Click SAVE AND FETCH RESPONSE.
    placesdata_params_add.png
  10. The Output Result dialog appears with the response. Otherwise, the Output Result shows an error.
    placesdata_Autocomp_Resp.png

Invoking the Back End Services on a Front End App

To link the MobileFabric app to your Visualizer project, do the following:

  1. Open Kony Visualizer. Expand the Project Settings tab.
  2. Under the Project Settings tab, right-click MobileFabric. Select the Use Existing App option.
  3. The MobileFabric Applications window appears. Search for the Places Data Google MobileFabric app and click Associate.
    placesdata_frontend_integ.png
  4. The MobileFabric app is now linked to your front end application.

Invoking Services

The Invoke functionality remains the same for all services. There is a change only in the parameters and their values. Select appropriate parameters and values while invoking the required services. The following sample code snippet shows how the services are invoked using code.

// Code to invoke parent integration service should be present to use below code. 
operationName = "konympPlplaceDetails";
        data= {"key": "<place-holder>","place_id": "<place-holder>"};,
        headers= {};
        integrationObj.invokeOperation(operationName, headers, data, operationSuccess, operationFailure);
function operationSuccess(res){
                //code for success call back
                }
 function operationSuccess(res){
                //code for success call back
                }

Defining Services

Services for Places Data (Google).

konympPlplaceDetails

Category: Google Places
Description: A Place Details request returns more comprehensive information about the indicated place, such as its complete address, phone number, user rating, and reviews. To know more about the Place Details service, click here.
Mandatory Parameters: key, place_id
Remarks:

You can also configure optional parameters in your MobileFabric app under Input Parameter tab. To know more about the optional parameters, click here.

 

konympPlsearchPlaceBasedOnQuery

Category: Google Places
Description: The Google Places API Text Search is a web service that returns information about a set of places based on a string. The service responds with a list of places matching the text string and any location bias that has been set.
To know more about the Google Places API Text Search service, click here.
Mandatory Parameters: key, address
Remarks:

You can also configure optional parameters in your MobileFabric app under Input Parameter tab. To know more about the optional parameters, click here.

 

konympPlsearchPlaceBasedOnLocation

Category: Google Places
Description: A Nearby Search lets you search for places within a specified area. You can refine your search request by entering keywords or by specifying the type of place you are searching for.
To know more about the Nearby Search service, click here.
Mandatory Parameters: key, location, radius, rankby
Remarks:

You can also configure optional parameters in your MobileFabric app under Input Parameter tab. To know more about the optional parameters, click here.

 

konympPlGoogleAutoComplete

Category: Google Places
Description: The Place Autocomplete is a web service that returns place predictions in response to an HTTP request. The HTTP request specifies a textual search string and optional geographic bounds.
To know more about the Place Autocomplete service, click here.
Mandatory Parameters: key, input
Remarks:

You can also configure optional parameters in your MobileFabric app under Input Parameter tab. To know more about the optional parameters click here.

 

konympPlgoogleDistanceMatrix

Category: Google Maps
Description: The Google Maps Distance Matrix API is a web service that provides travel distance and time for a matrix of origins and destinations, based on the recommended route between the start and end points.
To know more about the Google Maps Distance Matrix API service, click here.
Mandatory Parameters: units, origins, destinations, key
Remarks:

You can also configure optional parameters in your MobileFabric app under Input Parameter tab. To know more about the optional parameters click here.

 

konympPlgetGeocoding

Category: Google Maps
Description: The Google Maps Geocoding API is a web service that provides geocoding of addresses. To know more about the Google Maps Geocoding API service, click here.
Parameters: key, place_id

 

konympPlgetReverseGeoCoding

Category: Google Maps
Description: The Google Maps Geocoding API is a web service that provides reverse geocoding of addresses.
To know more about the Google Maps Geocoding API service, click here.
Parameters: key, address