/air-draw-demo

Primary LanguageKotlinApache License 2.0Apache-2.0

Air Draw

Local Dev

Run the web server:

./gradlew -t :server:run

Run the web asset server:

./gradlew -t :web:run

Visit: http://localhost:8080

Run the client:

  1. Download Android Command Line Tools:

  2. Install the SDK:

    mkdir android-sdk
    cd android-sdk
    unzip PATH_TO_SDK_ZIP/sdk-tools-linux-VERSION.zip
    tools/bin/sdkmanager --update
    tools/bin/sdkmanager "platforms;android-30" "build-tools;30.0.2" "extras;google;m2repository" "extras;android;m2repository"
    tools/bin/sdkmanager --licenses
    
  3. Add the following to your ~/.bashrc

    export ANDROID_SDK_ROOT=PATH_TO_SDK/android-sdk
    
  4. Source the new profile:

    source ~/.bashrc
    
  5. Run the build from this project's dir:

    ./gradlew :android:build
    
  6. For a physical device, setup adb

  7. Run on a device using an external server:

    ./gradlew android:installDebug -PdrawUrl=https://YOUR_URL/draw
    
  8. Or to run from Android Studio / IntelliJ, create a gradle.properties file in your root project directory containing:

    drawUrl=http://YOUR_DRAW_SERVER:8080/draw
    

    And setup the activity to first run Gradle-aware Make with a task of :android:assembleDebug

Use GCP for Pub/Sub & Vision API:

  1. Go to: https://console.cloud.google.com/apis/library/vision.googleapis.com

  2. Enable the Vision API

  3. Click "Create Credentials"

  4. Select "Cloud Vision API" at the API you are using

  5. Select "No, I’m not using them"

  6. Click "What Credentials do I need"

  7. Give the Service Account a name

  8. Select a role, like Project Editor

  9. Leave the JSON option selected and press "Continue"

  10. A JSON file will be downloaded to your machine

  11. Go to: https://console.cloud.google.com/cloudpubsub/topicList

  12. Create a topic named air-draw

  13. Create a subscription named air-draw

  14. Select "Never Expire"

  15. Press "Create"

  16. Run the app locally connecting to Pub/Sub and the Vision API:

    GOOGLE_APPLICATION_CREDENTIALS=YOUR_CREDS.json ./gradlew -t run
    

Build and Deploy manually:

gcloud config set run/region us-central1
gcloud services enable run.googleapis.com
gcloud builds submit --tag=gcr.io/$(gcloud config get-value project)/air-draw
gcloud beta run deploy air-draw --image gcr.io/$(gcloud config get-value project)/air-draw --allow-unauthenticated --memory=512Mi