Sample app showcasing how to use the Nest Android SDK.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
android-sdk-release
gradle/wrapper
testapp
.gitignore
CONTRIBUTING.md
LICENSE
README.md
build.gradle
gradle.properties
gradlew
gradlew.bat
settings.gradle

README.md

Nest Android app

Sample Android app demonstrating Nest Developer OAuth, REST streaming, and simple thermostat controls.

The app provides the following functionality:

  • Display structure name
  • Display home/away status
  • Display thermostat name
  • Display HVAC mode
  • Display current temperature in F
  • Display target temperature in F
  • Change target temperature in F
  • Change HVAC mode
  • Change home/away status

This sample application uses the Nest Thermostat features in the Nest Android SDK.
The Nest Android SDK can be used as the basis for other Works with Nest client functionality.

Set up your Works with Nest client and your simulated thermostat or Nest Learning Thermostat:

  1. Create a developer account at https://developer.nest.com, if you don't already have one.

    • Register a Works with Nest OAuth Client in the Nest Developer portal, if you don't already have one.
    • Edit the client Redirect URI as http://localhost:8080/auth/nest/callback.
    • Go to the permissions tab and add read/write permissions for Home/Away and the Thermostat.
      • If the write permissions are not added, the API calls from the click events in the Android app will throw an error.
  2. Create a user account at https://home.nest.com, if you don't already have one.

    • If you have a Nest Learning Thermostat, use that as the physical device to test with. If you don't have one, set up a virtual thermostat.
    • If using a physical device, go through the new device setup detailed in the included instructions.
    • If using a virtual device, create it in the Nest Home Simulator.
      • Sign in with your user account (from home.nest.com)
      • On the Structure screen, select ADD [DEVICE]

Configure the app

  1. Clone this repository:
git clone git@github.com:nestlabs/android-sdk-sample.git
  1. Import the project into Android Studio by selecting File > New > Import Project and selecting the directory you cloned above.

  2. Modify the Constants.java file to allow authorization with the Nest API:

    • Copy your Works with Nest OAuth client id, client secret and redirect URL from your client on the Nest Developer portal.

Build and run the app

  1. After importing the application, click 'Run' and select any Android emulator or device that is running API level 16 (Jelly Bean, Android 4.1) or greater.

  2. View your Nest Learning Thermostat or Nest Home Simulator to verify that the product and the Android UI are responding to events through the API calls in the sample code.

This sample app requires the user to have at least one thermostat to display and update correctly.

Contributing

Contributions are always welcome and highly encouraged.

See CONTRIBUTING for more information on how to get started.

License

Apache 2.0 - See LICENSE for more information.