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:
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
- 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.
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
- Clone this repository:
git clone email@example.com:nestlabs/android-sdk-sample.git
Import the project into Android Studio by selecting File > New > Import Project and selecting the directory you cloned above.
Constants.javafile 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
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.
This sample app requires the user to have at least one thermostat to display and update correctly.
Contributions are always welcome and highly encouraged.
See CONTRIBUTING for more information on how to get started.
Apache 2.0 - See LICENSE for more information.