Skip to content

Google Places API Library for Titanium Appcelerator Alloy

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE
Unknown
LICENSE.txt
Notifications You must be signed in to change notification settings

ajainvivek/Ti.Places

Repository files navigation

Ti.Places

Google Places API Library for Titanium Appcelerator Alloy.

Please feel free to contribute.

image

Usage

Create lib folder under app directory and then copy and paste the Ti.Place.js library. Visit https://console.developers.google.com and get google places webservice server key and add remote ip address for testing in emulator

1. Include Ti.Places Library

var places = require('ti.places');

2. Set the Google Place API Key.

places.setAPIKey("YOUR API KEY");

3. Search Places API

//Search Options
var searchOptions = {
	lat : -33.8670522, //latitude
	lon : 151.1957362, //longitude
	radius : 500, //radius in meters
	name : "", //name of place
	type : "atm | bank", //['airport', 'atm', 'bank', 'bar', 'parking', 'pet_store','pharmacy', 'police', 'post_office', 'shopping_mall']
	sensor : false, //sensor parameter to indicate whether your application used a sensor
	success: function (response) { //success callback
		//Code goes here..
	},
	fail : function () { //fail callback
		//Code goes here..
	}
};

places.api.searchPlace(searchOptions); //Execute the search query

4. Get Place Details Information API

Pass the reference id for specific place for fetching the place details.

//Get Place Details Options
var placeOptions = {
	reference : "CmRcAAAAferhk3fERWey5ZpxevSxsfEFZe59rDOE0Q8r72wOsdPhPcJfZO06moigXnatF0NxhWWE7GdO3acRqtwnfWWain6g5RABWxUQLzlvkeDy4BhCxgqZWUzrbQNF-96KjmgLEhBPsNtWUyjVRoJlAzA8alkrGhQ4uQtKjGuqzYr1C6hmVBpvmbBRLw",
	sensor : true, //sensor parameter to indicate whether your application used a sensor
	success: function (response) { //success callback
		//code goes here..
	},
	fail : function () { //fail callback
		//code goes here...
	}
};

places.api.getPlaceDetails(placeOptions); //Execute the place details query

5. Query AutoComplete API

//AutoComplete Options
var autoCompleteOptions = {
	type: "establishment", //default: geocode
	success: function (response) { //success callback
		//code goes here..
	},
	fail : function () { //fail callback
		//code goes here..
	}
};

//On Search Place Trigger AutoComplete Search
$.searchPlace.addEventListener("change", function (e) {
	autoCompleteOptions.input = e.value;
	places.api.autoComplete(autoCompleteOptions);
});

Features

  • Search Places
  • Get Place Details
  • Query for Auto Complete
  • Works in android/ios

##Notes

  • Any bugs please raise a ticket
  • If the libray helped you then please click on star to support it :)

About

Google Places API Library for Titanium Appcelerator Alloy

Resources

License

Unknown, Unknown licenses found

Licenses found

Unknown
LICENSE
Unknown
LICENSE.txt

Stars

Watchers

Forks

Releases

No releases published

Packages