GithubHelp home page GithubHelp logo

isabella232 / appengine-endpoints-helloendpoints-android Goto Github PK

View Code? Open in Web Editor NEW

This project forked from googlearchive/appengine-endpoints-helloendpoints-android

0.0 0.0 0.0 691 KB

This repository is a HelloWorld Android sample application that connects to a HelloWorld Google Cloud Endpoints backend sample.

License: Apache License 2.0

Java 100.00%

appengine-endpoints-helloendpoints-android's Introduction

appengine-endpoints-helloendpoints-android

status: inactive

This project is no longer actively developed or maintained.

For new work on this check out android-docs-samples.

This application is a HelloWorld Android sample application that connects to a HelloWorld Google Cloud Endpoints backend sample.

Products

Language

APIs

Setup Instructions

  1. Deploy a Google Cloud Endpoints backend sample that this client app will use as an API server. Proceed with optional authentication steps during setup.

  2. Install Android Studio.

  3. Download code git clone https://github.com/GoogleCloudPlatform/appengine-endpoints-helloendpoints-android.git

  4. Import the project:

    1. Open AndroidStudio and choose "Import Project."
    2. Select the build.gradle file in the HelloEndpointsProject directory and use default values for the rest of the import screens.
    3. NOTE: If you recieve an import error indicating that "play-services", a required dependency, could not be found that is OK. It will be resolved by the following step.
  5. Check dependencies (even if the project compiles) using the Android SDK Manager. Ensure the following packages are installed and up-to-date:

    1. Android Support Repository
    2. Android Support Library
    3. Google Play Services
    4. Google Repository
  6. Close and reopen your project. Clean dependencies using the Build menu by choosing "Rebuild Project."

  7. Update the file HelloEndpointsProject/HelloEndpoints/src/main/java/com/google/api/services/helloworld/Helloworld.java with the location of your deployed API. DEFAULT_ROOT_URL should include your App Engine app ID.

  8. Deploy the Android App

    1. Deploy your app via normal Android deployment procedures.

NOTE: At this point you can deploy the app and all anonymous API calls will work. The authenticated API call will not work; continue on to configure the Android application to securely communicate with your backend sample.

  1. Register an Android Application to access your Google Cloud Endpoints backend project.

    1. Navigate to the Google Cloud Console. Select the Google Cloud Endpoints Backend project that was deployed as in Step 1.
    2. Navigate to the "APIs & Auth," item of the left menu bar.
    3. Choose the "Credentials" submenu item.
    4. Click "Create new Client ID" and select "Installed Application" and "Android."
    5. Use com.google.devrel.samples.helloendpoints as the package name.
    6. Retrieve your debugging keystore fingerprint from ADB. On a Mac this command would typically look like this with an empty password: keytool -list -v -keystore ~/.android/debug.keystore
    7. Click "Create Client ID."
  2. Associate your Google Cloud Endpoints backend project to the Android application.

    1. Update the file HelloEngpoints/src/main/java/com/google/devrel/samples/helloendpoints/AppConstants.java. WEB_CLIENT_ID field should be updated with the web application client ID that is defined in the "APIs & Auth" -> "Credentials" screen of your Google Cloud Endpoints backend project. You will be using the Client ID specified for "Compute Engine and App Engine."
    2. You will similarly need to update your Google Cloud Endpoints backend sample with the Android application client ID as well. Do not forget to recompile your backend app (such as with mvn clean install for the Java one).
  3. Deploy the Android App

    1. Deploy your app via normal Android deployment procedures.
    2. You will need to use a version 17 or later "Google APIs" enabled AVD definition if you are using an emulator instead of a physical device. Physical devices need only Google Play (Services) installed to work.
  4. A quick note about the Client IDs used above for Authentication. -Client IDs identify applications (client or backend) to Google. The authenticated APIs in this sample utilize OAuth2 authentication. OAuth2 tokens are issued to specific Client IDs and therefore the Client IDs can be used for restricting access to your APIs. -When you create a Google Cloud Console Project a default Client ID is created and named for use by the project. When you upload an App Engine project it uses that Client ID. This becomes the WEB_CLIENT_ID referenced in the Android/iOS/Backend samples. -When you register the iOS or Android Applications in the Google Cloud Console you are creating another Client ID. This Client ID is the one requesting an OAuth2 token from Google for authentication purposes. When the API is used in an authenticated manner an OAuth2 access token is sent and opened by Google Cloud Endpoints. The Client ID is extracted from the token and compared to the backend's declared acceptable Client ID list.

appengine-endpoints-helloendpoints-android's People

Contributors

elibixby avatar frankyn avatar paulrashidi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.