Update Android Helloworld example

pull/3109/head
Xiao Hang 10 years ago
parent 36ee029e65
commit b8942be562
  1. 1
      README.md
  2. 0
      java/android/GreeterGrpc.java
  3. 0
      java/android/Helloworld.java
  4. 5
      java/android/HelloworldActivity.java
  5. 16
      java/android/README.md
  6. 0
      java/android/activity_helloworld.xml

@ -15,6 +15,7 @@ You can find quick start guides for each language, including installation instru
* [Go](https://github.com/grpc/grpc-common/tree/master/go)
* [ruby](https://github.com/grpc/grpc-common/tree/master/ruby)
* [Node.js](https://github.com/grpc/grpc-common/tree/master/node)
* [Android Java](https://github.com/grpc/grpc-common/tree/master/java/android)
* Python is coming soon
## What's in this repository?

@ -1,4 +1,4 @@
package io.grpc.helloworld;
package io.grpc.helloworldexample;
import android.content.Context;
import android.support.v7.app.ActionBarActivity;
@ -84,9 +84,10 @@ public class Helloworld extends ActionBarActivity {
try {
mChannel.shutdown().awaitTerminated(1, TimeUnit.SECONDS);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
mResultText.setText(result);
mSendButton.setEnabled(true);
}
}
}
}

@ -1,4 +1,4 @@
gRPC Hello World Tutorial (gRPC Java on Android)
gRPC Hello World Tutorial (Android Java)
========================
BACKGROUND
@ -15,26 +15,26 @@ PREREQUISITES
INSTALL
-------
1 Clone the gRPC Java git repo
1. Clone the gRPC Java git repo
```sh
$ git clone https://github.com/grpc/grpc-java
```
2 Install gRPC Java, as described in [How to Build](https://github.com/grpc/grpc-java#how-to-build)
2. Install gRPC Java, as described in [How to Build](https://github.com/grpc/grpc-java#how-to-build)
```sh
$ # from this dir
$ cd grpc-java
$ # follow the instructions in 'How to Build'
```
3 [Create an Android project](https://developer.android.com/training/basics/firstapp/creating-project.html) under your working directory.
3. [Create an Android project](https://developer.android.com/training/basics/firstapp/creating-project.html) under your working directory.
- Set Application name to "Helloworld Example" and set Company Domain to "grpc.io". Make sure your package name is "io.grpc.helloworldexample"
- Choose appropriate minimum SDK
- Use Blank Activity
- Set Activity Name to HelloworldActivity
- Set Layout Name to activity_helloworld
4 Prepare the app
4. Prepare the app
- Clone this git repo
```sh
$ git clone https://github.com/grpc/grpc-common
@ -48,7 +48,7 @@ $ git clone https://github.com/grpc/grpc-common
```
added outside your appplication tag
5 Add dependencies. gRPC Java on Android depends on grpc-java, protobuf nano, okhttp
5. Add dependencies. gRPC Java on Android depends on grpc-java, protobuf nano, okhttp
- Copy grpc-java .jar files to your_app_dir/app/libs/:
- grpc-java/core/build/libs/*.jar
- grpc-java/stub/build/libs/*.jar
@ -61,11 +61,11 @@ added outside your appplication tag
```sh
$ cp ~/.m2/repository/com/google/protobuf/nano/protobuf-javanano/2.6.2-pre/protobuf-javanano-2.6.2-pre.jar your_app_dir/app/libs/
```
- Make sure your app/build.gradle contains:
- Make sure your_app_dir/app/build.gradle contains:
```sh
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
```
6 [Run your example app](https://developer.android.com/training/basics/firstapp/running-app.html)
6. [Run your example app](https://developer.android.com/training/basics/firstapp/running-app.html)
Loading…
Cancel
Save