Select from the drop down menu at the top of the page.
Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.
Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.
In order to run this sketch, it needs to be configured with an appropriate TembooAccount.h
header file containing your Temboo account information. Header files for certain boards will also include the device’s internet connection details.
To create the header file, make a new tab in the IDE, and name it TembooAccount.h
.
TembooAccount.h
tab in your IDE.We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.
Select from the drop down menu at the top of the page.
Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.
Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.
In order to run this sketch, it needs to be configured with an appropriate TembooAccount.h
header file containing your Temboo account information. Header files for certain boards will also include the device’s internet connection details.
To create the header file, make a new tab in the IDE, and name it TembooAccount.h
.
TembooAccount.h
tab in your IDE.We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.
Select from the drop down menu at the top of the page.
Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.
Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.
In order to run this sketch, it needs to be configured with an appropriate TembooAccount.h
header file containing your Temboo account information. Header files for certain boards will also include the device’s internet connection details.
To create the header file, make a new tab in the IDE, and name it TembooAccount.h
.
TembooAccount.h
tab in your IDE.The final step before running any sketch is to confirm that you've selected the appropriate board and serial port in Energia. Go to the Tools > Board menu and select the LaunchPad you're working with. Then go to Tools > Serial Port and select the port your board is connected to.
We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.
Select from the drop down menu at the top of the page.
Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.
Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.
Scroll down to the code box of the Choreo page. Click Send to CCS Cloud to the right of your generated code. Name your application and click Send. Click the link that appears to visit the CCS Cloud IDE in your browser.
Run the code on your CC3220 from CCS Cloud. After running the code, open the Serial Monitor and you'll see the response from the Choreo.
We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.
If this is your first time using Temboo, you'll need to set up your ARTIK board to find the Temboo libraries. To do so, you'll need to create the file temboo.conf
in /etc/ld.so.conf.d
. Inside of temboo.conf
, you'll want to copy the line below and paste it into the file:
/opt/iothub/artik/temboo/temboo_artik_library/lib
temboo.conf
, run ldconfig
from the command line to add the Temboo library directory to the system library search path.You’ll also need to get the IP address of your ARTIK board using ifconfig
. The example below shows the results when the ARTIK board is connected to the internet through an ethernet cable. The IP address you'll want to use is listed next to inet.
[root@localhost ~]$ ifconfig eth0: flags=4163mtu 1500 inet 10.11.6.200 netmask 255.255.255.0 broadcast 10.11.6.255
Select from the drop down menu at the top of the page.
Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.
Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.
Download the generated code to your computer by clicking Download source code to the right of the code.
Copy the downloaded zip file to your ARTIK board using scp
. From your computer, go to the directory where the zip file is located and type the command below. Make sure you use the IP address for your board you found using ifconfig
.
[root@localhost ~]$ scp .zip root@xxx.xxx.xxx.xxx:/home
From the ARTIK command line (either through a serial terminal or ssh session), change your current directory to /home
. Next, unzip the generated code you just copied over. You can unzip the file by using the command below:
[root@localhost ~]$ unzip .zip
Now go to the directory and compile and run your code using the commands below. Run the first command to compile your code. After compiling has finished and no errors have been reported, run your program using the second command. After running the program, you should see the response from in your console.
[root@localhost ~]$ gcc -L/opt/iothub/artik/temboo/temboo_artik_library/lib -ltemboo -I/opt/iothub/artik/temboo/temboo_artik_library/include s.c -o [root@localhost ~]$ ./
Note: If you get an error about cdefs.h not being found, this could mean your ARTIK board was not shipped with glibc-headers. This can be solved by reinstalling glibc-headers using the command below. After reinstalling glibc-headers, run the two commands above to compile and run your code.
[root@localhost ~]$ yum reinstall glibc-headers
We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.
.jar
file (e.g. temboo-android-sdk-core-2.19.0.jar
) in the Temboo SDK folder you just downloaded and extracted.libs
folder of your projectYou've now added the core Temboo SDK to your project. Repeat the above steps to add the application bundle (e.g. -2.19.0.jar
) from the Temboo SDK folder you just extracted, which will allow us to use APIs.
We'll now make some adjustments to the default application that Android Studio has generated for us.
app/src/main/res/AndroidManifest.xml
. In order to access the internet, you will need to add <uses-permission android:name="android.permission.INTERNET"/>
below the <application>
tag.TextView
that we'll make use of, but before we can do so we need to give it an identifier. Locate and double-click on the fileapp > src > main > res > layout > activity_main.xml
. This file describes the layout of our MainActivity
class.TextView
.@+id/response
Select from the drop down menu at the top of the page.
Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.
Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.
Because network operations block the main thread execution, we'll need to make our calls to Temboo using AsyncTask
. Create a new class that extends AsyncTask
called GeocodingTask
(or whatever you like), adding the @Override
implementations for doInBackground
and onProcessComplete
:
package com.temboo.android.gettingstarted.app; import android.os.AsyncTask; import android.util.Log; import android.widget.TextView; /** * An AsyncTask that will be used to interact with Temboo */ class GeocodingTask extends AsyncTask<Void, Void, String> { private TextView textView; public GeocodingTask(TextView textView){ this.textView = textView; } @Override protected String doInBackground(Void... arg0) { try { // Temboo code will go here } catch(Exception e) { // if an exception occurred, log it Log.e(this.getClass().toString(), e.getMessage()); } return null; } protected void onPostExecute(String result) { try { // Will update UI here } catch(Exception e) { // if an exception occurred, show an error message Log.e(this.getClass().toString(), e.getMessage()); } } }
TextView
as an argument. This will reference the TextView
we set up earlier.Now that our AsyncTask
is set up, copy the generated code snippet from the Temboo website and paste it into the doInBackground
method of your AsyncTask
class. We'll also add the required imports to create a GeocodeByAddress
Choreo, GeocodeByAddressInputSet
, and GeocodeByAddressResultSet
:
import com.temboo.Library.Google.Geocoding.GeocodeByAddress; import com.temboo.Library.Google.Geocoding.GeocodeByAddress.GeocodeByAddressInputSet; import com.temboo.Library.Google.Geocoding.GeocodeByAddress.GeocodeByAddressResultSet; import com.temboo.core.TembooSession;
Each Choreo in the Android SDK returns a ResultSet
subclass that contains get methods tailored specifically to the outputs of that Choreo. Using the ResultSet
, you can retrieve the raw data (typically XML or JSON) returned by a third-party API or relevant fields that we've parsed out of the response for you.
To update the UI with the latitude and longitude returned by the Choreo, do the following:
Add the following code at the bottom of the try
block of the doInBackground
method in your class:
return geocodeByAddressResults.get_Latitude() + "/" + geocodeByAddressResults.get_Longitude();
The return value we've just added is passed by Android as an argument to the onPostExecute
method, we'll update the UI there:
protected void onPostExecute(String result) { try { // Update the UI textView.setText(result); } catch(Exception e) { // if an exception occurred, show an error message Log.e(this.getClass().toString(), e.getMessage()); } }
That's it! At this point, your AsyncTask
implementation should look something like this:
package com.temboo.android.gettingstarted.app; import android.os.AsyncTask; import android.util.Log; import android.widget.TextView; import com.temboo.Library.Google.Geocoding.GeocodeByAddress; import com.temboo.Library.Google.Geocoding.GeocodeByAddress.GeocodeByAddressInputSet; import com.temboo.Library.Google.Geocoding.GeocodeByAddress.GeocodeByAddressResultSet; import com.temboo.core.TembooSession; /** * An AsyncTask that will be used to interact with Temboo */ class GeocodingTask extends AsyncTask<Void, Void, String> { private TextView textView; public GeocodingTask(TextView textView){ this.textView = textView; } @Override protected String doInBackground(Void... arg0) { try { // Instantiate the Choreo, using a previously instantiated TembooSession object, eg: TembooSession session = new TembooSession("ACCOUNT_NAME", "APP_NAME", "APP_KEY"); GeocodeByAddress geocodeByAddressChoreo = new GeocodeByAddress(session); // Get an InputSet object for the choreo GeocodeByAddressInputSet geocodeByAddressInputs = geocodeByAddressChoreo.newInputSet(); // Set inputs geocodeByAddressInputs.set_Address("104 Franklin Street, New York City"); // Execute Choreo GeocodeByAddressResultSet geocodeByAddressResults = geocodeByAddressChoreo.execute(geocodeByAddressInputs); return geocodeByAddressResults.get_Latitude() + "/" + geocodeByAddressResults.get_Longitude(); } catch(Exception e) { // if an exception occurred, log it Log.e(this.getClass().toString(), e.getMessage()); } return null; } protected void onPostExecute(String result) { try { // Update UI textView.setText(result); } catch(Exception e) { // if an exception occurred, show an error message Log.e(this.getClass().toString(), e.getMessage()); } } }
In order to see your new task in action, you will need to invoke it from the MainActivity
class created with your project. The simplest way to do this is to add a call to it in the onCreate
method, which should end up looking like this:
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView textView = (TextView) findViewById(R.id.response); new GeocodingTask(textView).execute(); }
Deploy and run the application. After a few moments the output from the Choreo call should be printed to your device's (or the emulator's) screen. Congrats! You just ran your first Choreo from our Android SDK.
We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.
TembooTest
. The new project should automatically include a C# class file called Program.cs
containing a Main
method.References
folder under TembooTest
and select Add Reference. In the dialogue box that appears, click Browse and select TembooSDK.dll
located in the bin
folder within the extracted Temboo SDK directory. Click OK.Select from the drop down menu at the top of the page.
Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.
Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.
Program.cs
with the copied code.At this point, the app is ready to run but by default it will exit the console session immediately. To make sure the output is visible, let's update the code to print the results returned from Google's Geocoding service and wait for input before terminating.
Each Choreo in the C# SDK returns a ResultSet
subclass that contains get methods tailored specifically to the outputs of that Choreo. Using the ResultSet
, you can retrieve the raw data (typically XML or JSON) returned by a third-party API or relevant fields that we've parsed out of the response for you.
Update the the Main
method in your class, so that the final lines look like:
// Print results Console.WriteLine("Latitude: " + geocodeByAddressResults.Latitude); Console.WriteLine("Longitude: " + geocodeByAddressResults.Longitude); Console.WriteLine("Press any key to continue..."); Console.ReadKey();
Run the code and you will see the results in the console. Congrats! You just ran your first Choreo from our C# SDK.
We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.
TembooTest
, select Objective-C as the Language, and click Next (the other fields are optional and may be left blank) to save your new project.TembooTest
and contain a file called main.m
), then select Add Files to TembooTest from the File menu. Browse to where you saved the Temboo SDK, locate and click on the core
folder inside the SDK src
folder. Make sure that Copy items if needed is unchecked and Create groups is selected, and then click Add.TMB.h
and TMB.m
files located in the SDk's src/library
folder.Select from the drop down menu at the top of the page.
Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.
Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.
main.m
file, below the import statement for <Foundation/Foundation.h>
and above the main
method. Finally, update the main
method in main.m
with the code below so that your file calls the Geocoding Choreo:
int main(int argc, const char * argv[]) { @autoreleasepool { // Create a new instance of our class GeocodeByAddress *tutorial = [[GeocodeByAddress alloc] init]; // Run it [tutorial runGeocodeByAddressChoreo]; // Only needed for command line tools, this simply keeps the program from exiting immediately [[NSRunLoop currentRunLoop] run]; } return 0; }
Each Choreo in the iOS SDK returns a ResultSet
subclass that contains get methods tailored specifically to the outputs of that Choreo. Using the ResultSet
, you can retrieve the raw data (typically XML or JSON) returned by a third-party API or relevant fields that we've parsed out of the response for you. Our snippets include code to print out the results returned by the Choreo in question.
We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.
/libs
./libs
folder. Refresh the project, then right-click the JAR file and select: Build Path > Add to Build Path.main
method to your project. You can call it whatever you like.Select from the drop down menu at the top of the page.
Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.
Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.
main
method of your Java class. Press Cmd+Shift+O
(or Ctrl+Shift+O
in Windows) to automatically import dependencies. Note: your main method should declare that it throws Exception
.Before we try a test run of the app, let's update the code to print the results returned from Google's Geocoding service.
Each Choreo in the Java SDK returns a ResultSet
subclass that contains get methods tailored specifically to the outputs of that Choreo. Using the ResultSet
, you can retrieve the raw data (typically XML or JSON) returned by a third-party API or relevant fields that we've parsed out of the response for you.
To print the latitude and longitude returned by the Choreo, simply do the following:
Add the following code at the bottom of the main
method in your class:
// Print lat and lon System.out.println("Latitude: " + geocodeByAddressResults.get_Latitude()); System.out.println("Longitude: " + geocodeByAddressResults.get_Longitude());
Run the code and you will see the results in the console. Congrats! You just ran your first Choreo from our Java SDK.
We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.
.html
file and save it as temboo-example.html
into a folder where you'll save the rest of your project files..php
file and save it as proxy-server.php
into the same project folder as your temboo-example.html
file.js-sdk
and move it into the same folder as your temboo-example.html
file.Change the name of the resulting folder to php-sdk
and move it into the same folder as your temboo-example.html
file. Your project folder should look similar to the screenshot below:
Select from the drop down menu at the top of the page.
Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.
Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.
temboo-example.html
file.In your temboo-example.html
file, make sure that your script source points to the correct location of the temboo.js
SDK file.
<script src="js-sdk/js/temboo.js"></script>
In the same file, we'll also want to confirm that the location of our proxy is correctly specified. Our server is proxy-server.php
.
// Instantiate the client proxy with the URI of your server proxy var temboo = new TembooProxy('proxy-server.php');
Back on the Choreo page, scroll down to the Proxy Code snippet and select PHP or another server-side proxy language from the Proxy Code Language dropdown menu. Copy the proxy code snippet and paste it into your proxy-server.php
file.
In the same .php
file, make sure that the php-sdk
SDK folder that you downloaded earlier.
require 'php-sdk/src/temboo.php';
Run the PHP server. For instance, if you're running the code using a web host, you can upload your project folder to your site via FTP client. If you're using Apache for PHP to run a local server, you'd run the following command from Terminal:
sudo apachectl start
Go to temboo-example.html
in the browser at the url where you're server is running. For instance, if you're running the PHP server locally:
127.0.0.1/projectFolderName/temboo-example.html
Congrats! You just ran your first Choreo from our JavaScript SDK. Take a look at the developer console and you'll see the full Output.
We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.
tembootest.js
, though you can call it whatever you like.node_modules
in accordance with the convention established by the Node Package Manager. Move the node_modules
folder to the same directory as your new .js project file.Select from the drop down menu at the top of the page.
Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.
Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.
Make sure that all of your import statements are included. Both of the following lines should be present and uncommented in your code.
var tsession = require("temboo/core/temboosession"); var Google = require("temboo/Library/Google/Geocoding");
Before we try a test run of the app, let's update the code to print the results returned from Google's Geocoding service.
Each Choreo in the SDK returns a ResultSet
subclass that contains accessor methods tailored specifically to the outputs of that Choreo. Using the ResultSet
, you can retrieve the raw data XML or JSON returned by a third-party API and, in most cases, relevant fields that we've parsed out of the response for you. Remember, sample code for every Choreo can be found in the Library.
The example code already logs the longitude, you simply have to ask it to log the latitude as well:
Edit the success callback (function(results){...}
) so that it looks like this:
function(results) { console.log("Latitude: %s", results.get_Latitude()); console.log("Longitude: %s", results.get_Longitude()); }
Your finished version of the execute()
method should look like this:
// Run the choreo, specifying success and error callback handlers geocodeByAddressChoreo.execute( geocodeByAddressInputs, function(results) { console.log("Latitude: %s", results.get_Latitude()); console.log("Longitude: %s", results.get_Longitude()); }, function(error){console.log(error.type); console.log(error.message);} );
Now you're ready to run the script and see the output. Here's the command you need to run if you're executing this from the command line. Otherwise just run it from your IDE.
node tembootest.js
Congrats! You just ran your first Choreo from our Node.js SDK! You should see the coordinates for the address you specified printed to the console.
We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.
Unzip the downloaded SDK and move the resulting php-sdk folder into the same parent folder as your new, blank PHP file.
Add the Temboo PHP SDK to your script:
require 'php-sdk/src/temboo.php';
Select from the drop down menu at the top of the page.
Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.
Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.
Before we try a test run of the script, let's update the code to print the results returned from Google's Geocoding service.
Each Choreo in the PHP SDK returns a Temboo_Results
subclass that contains get methods tailored specifically to the outputs of that Choreo. Using the Temboo_Results
, you can retrieve the raw data (typically XML or JSON) returned by a third-party API or relevant fields that we've parsed out of the response for you.
To print the latitude and longitude returned by the Choreo, simply add the following code at the bottom of your script:
// Print lat and lon echo "Latitude: " . $geocodeByAddressResults->getLatitude() . "\n"; echo "Longitude: " . $geocodeByAddressResults->getLongitude() . "\n";
Run the code and you will see the results in the console. Congrats! You just ran your first Choreo from our PHP SDK.
We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.
temboo
folder into your Documents/Processing/libraries/
folder (or My Documents/Processing/libraries/
on a PC). If Processing is currently open, restart it so that it will recognize the Temboo library that you just added.Select from the drop down menu at the top of the page.
Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.
Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.
In order to run this sketch, your Temboo account name and application details must be included in the TembooSession
, like so:
When you're logged in, this information is automatically populated in your generated sketch. Remember to remove your account details if you share your sketch.
Run the sketch from Processing, and you will see the results in the Processing console. Congrats! You just ran your first Choreo in Processing.
We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.
TembooTest.py
, though you can call it whatever you like.Select from the drop down menu at the top of the page.
Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.
Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.
TembooTest.py
file.Now you're ready to run the script and see the output. Here's the command you need to run if you're executing this from the command line. Otherwise just run it from your IDE.
python TembooTest.py
We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.
gem install temboo-ruby-sdk-x.gem
, where x is the version number. You will now be able to access Temboo's Ruby SDK in your code.Select from the drop down menu at the top of the page.
Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.
Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.
Make sure your imports are in place at the top of the file. They should look like the sample below.
require "temboo" require "Library/Google"
Before we try a test run of the app, let's update the code to print the results returned from Google's Geocoding service.
Each Choreo in the SDK returns a ResultSet
subclass that contains get methods tailored specifically to the outputs of that Choreo. Using the ResultSet
, you can retrieve the raw data (typically XML or JSON) returned by a third-party API or relevant fields that we've parsed out of the response for you.
To print the latitude and longitude returned by the Choreo, simply add the following code at the bottom of your script:
# Print lat/lon printf("Latitude: %s\n", geocodeByAddressResults.get_Latitude()) printf("Longitude: %s\n", geocodeByAddressResults.get_Longitude())
We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.
Select from the drop down menu at the top of the page.
Enter any address or ZIP code in the Address input field, e.g., 104 Franklin Street, New York City.
Click Generate Code to test the Choreo from our website. After a moment you'll see the data that Google sends back shown in the Output section.
We're always happy to help. Just email us at support@temboo.com, and we'll answer your questions.