-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fully split the Android sample and Android SDK builds
- Loading branch information
Showing
39 changed files
with
246 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
rootProject.name='IoTSamples' | ||
include ':app' | ||
rootProject.name='aws-iot-device-sdk-android' | ||
include ':iotdevicesdk' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# AWS IoT Device SDK for Android | ||
|
||
This document provides information about building and using the AWS IoT device SDK for Java V2 with Android. | ||
|
||
If you have any issues or feature requests, please file an issue or pull request. | ||
|
||
API documentation: https://aws.github.io/aws-iot-device-sdk-java-v2/ | ||
|
||
This SDK is built on the AWS Common Runtime, a collection of libraries | ||
([aws-c-common](https://github.com/awslabs/aws-c-common), | ||
[aws-c-io](https://github.com/awslabs/aws-c-io), | ||
[aws-c-mqtt](https://github.com/awslabs/aws-c-mqtt), | ||
[aws-c-http](https://github.com/awslabs/aws-c-http), | ||
[aws-c-cal](https://github.com/awslabs/aws-c-cal), | ||
[aws-c-auth](https://github.com/awslabs/aws-c-auth), | ||
[s2n](https://github.com/awslabs/s2n)...) written in C to be | ||
cross-platform, high-performance, secure, and reliable. The libraries are bound | ||
to Java by the [aws-crt-java](https://github.com/awslabs/aws-crt-java) package. | ||
An Android library of the aws-crt-java package is built from the same library and is | ||
a dependency of the aws-iot-device-sdk-android library. | ||
|
||
*__Jump To:__* | ||
|
||
* [Installation](#installation) | ||
* [Minimum requirements](#minimum-requirements) | ||
* [Build and install IoT Device SDK from source](#build-and-install-iot-device-sdk-from-source) | ||
* [Consuming IoT Device SDK Android](#consuming-from-locally-installed) | ||
* [Consuming from Maven](#consuming-from-maven) | ||
* [Consuming from locally installed](#consuming-from-locally-installed) | ||
* [Samples App](#samples-app) | ||
|
||
## Installation | ||
|
||
### Minimum requirements | ||
* Java 11+ ([Download and Install Java](https://www.java.com/en/download/help/download_options.html)) | ||
* [Set JAVA_HOME](./PREREQUISITES.md#set-java_home) | ||
* Gradle 7.4.2 ([Download and Install Gradle](https://gradle.org/install/)) | ||
* Android SDK 26 ([Doanload SDK Manager](https://developer.android.com/tools/releases/platform-tools#downloads)) | ||
* [Set ANDROID_HOME](./PREREQUISITES.md#set-android_home) | ||
|
||
### Build and install IoT Device SDK from source | ||
Supports API 26 or newer. | ||
NOTE: The shadow sample does not currently complete on android due to its dependence on stdin keyboard input. | ||
|
||
``` sh | ||
# Create a workspace directory to hold all the SDK files | ||
mkdir sdk-workspace | ||
cd sdk-workspace | ||
# Clone the SDK repository | ||
# (Use the latest version of the SDK here instead of "v1.17.0) | ||
git clone --branch v1.17.0 --recurse-submodules https://github.com/aws/aws-iot-device-sdk-java-v2.git | ||
# Compile and install the SDK for Android | ||
cd aws-iot-device-sdk-java-v2/android | ||
./gradlew build | ||
# Install SDK locally | ||
./gradlew publishToMavenLocal | ||
``` | ||
|
||
## Consuming IoT Device SDK Android | ||
|
||
### Consuming from Maven | ||
##### NOTE: aws-iot-device-sdk-android is not currently available in Maven but will be shortly. For now, please publish to maven locally and [Consume from locally installed](#consuming-from-locally-installed) | ||
Consuming this SDK via Maven is the preferred method of consuming it and using it within your application. To consume | ||
IoT Device SDK Android in your application, add the following to your `build.gradle` repositories and dependencies: | ||
|
||
``` groovy | ||
repositories { | ||
mavenCentral() | ||
} | ||
dependencies { | ||
api 'software.amazon.awssdk.iotdevicesdk:aws-iot-device-sdk-android:1.17.0' | ||
} | ||
``` | ||
Replace `1.17.0` in `software.amazon.awssdk.iotdevicesdk:aws-iot-device-sdk-android:1.17.0` with the latest release version for the SDK. | ||
Look up the latest SDK version here: https://github.com/aws/aws-iot-device-sdk-java-v2/releases | ||
|
||
### Consuming from locally installed | ||
You may also consume IoT Device SDK Android in your application using a locally installed version by adding the | ||
following to your `build.gradle` repositories and depenencies: | ||
``` groovy | ||
repositories { | ||
mavenLocal() | ||
} | ||
dependencies { | ||
api 'software.amazon.awssdk.iotdevicesdk:aws-iot-device-sdk-android:1.17.0' | ||
} | ||
``` | ||
Replace `1.17.0` in `software.amazon.awssdk.iotdevicesdk:aws-iot-device-sdk-android:1.17.0` with the latest release version for the SDK | ||
or replace with `1.0.0-SNAPSHOT` to use the SDK built and installed from source. | ||
Look up the latest SDK version here: https://github.com/aws/aws-iot-device-sdk-java-v2/releases | ||
|
||
## Samples App | ||
[Android IoT Samples App README](../samples/Android/README.md) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/.gradle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# Sample Application for the AWS IoT Device SDK Android | ||
[**Return to AWS IoT Device SDK for Android README**](../../documents/ANDROID.md) | ||
|
||
The Android sample builds an app that can be installed and run on an Android Device. The app builds and allows you | ||
to run the following [samples](#links-to-individual-sample-readme-files) from aws-iot-device-sdk-java-v2: | ||
* BasicPubSub | ||
* Mqtt5PubSub | ||
* Jobs | ||
* Shadow | ||
* CognitoConnect | ||
|
||
*__Jump To:__* | ||
|
||
* [Prerequisites](#prerequisites) | ||
* [Files required to run samples](#files-required-to-run-samples) | ||
* [Build and install sample app](#build-and-install-sample-app) | ||
* [Links to sample README](#links-to-individual-sample-readme-files) | ||
|
||
|
||
# Prerequisites | ||
The individual samples within the app require specific files to operate. The files must be placed in the | ||
`app/src/main/assets` directory prior to building for the sample app to connect to IoT Core and complete | ||
succesfully. The names of the files must be exactly as provided. Explanations for what each file and | ||
associated argument are doing can be found in the individual [Sample README](#links-to-individual-sample-readme-files) | ||
files linked below. | ||
|
||
## Files required to run samples | ||
|
||
### Files required by all samples: | ||
* `endpoint.txt` - IoT ATS Endpoint | ||
|
||
### Required to run BasicPubSub, Mqtt5PubSub, Jobs, and Shadow samples | ||
* `certificate.pem` - IoT Thing Certificate | ||
* `privatekey.pem` - IoT Thing Private Key | ||
|
||
### Required to run Cognito Client sample: | ||
* `cognitoIdentity.txt` - Cognito identity ID | ||
* `signingRegion.txt` - Signing region | ||
|
||
### Optional files: | ||
* `rootca.pem` - override the default system trust store | ||
* `clientId.txt` - specifies --clientId CLI argument | ||
* `topic.txt` - specifies --topic CLI argument | ||
* `message.txt` - specifies --message CLI argument | ||
* `port.txt` - specifies --port CLI argument | ||
* `thingName.txt` - specifies --thingName CLI argument | ||
|
||
# Build and install sample app | ||
|
||
``` sh | ||
# Change to the app directory | ||
cd samples/Android/app | ||
# Use gradlew from the android folder to build the sample app | ||
../../../android/gradlew build | ||
|
||
# Install it to a connected Device | ||
../../../android/gradlew installDebug | ||
``` | ||
|
||
# Links to individual sample README files | ||
The following links will provide more details on the individual samples available in the | ||
Android sample app. | ||
|
||
[**BasicPubSub**](../BasicPubSub/README.md) | ||
|
||
[**Mqtt5PubSub**](../Mqtt5/PubSub/README.md) | ||
|
||
[**Jobs**](../Jobs/README.md) | ||
|
||
[**Shadow**](../Shadow/README.md) | ||
|
||
[**CognitoConnect**](../CognitoConnect/README.md) | ||
|
||
##### NOTE: The shadow sample does not currently complete on android due to its dependence on stdin keyboard input. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/build | ||
./gradle | ||
/local.properties | ||
/.gradle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.