Skip to content

Commit 3b08a34

Browse files
committed
Update README.md.
1 parent dece98d commit 3b08a34

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

README.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ dependencies {
3737

3838
## Getting Started
3939

40-
Define a normal java Interface with `@ClassName` and `@MethodName` annotation, and implement the interface.
40+
Define a normal java Interface with `@ClassName` and `@MethodName` annotation, and implements the interface.
4141

4242
```java
43-
@ClassName("com.codezjx.example.IRemoteService")
43+
@ClassName("com.example.andlinker.IRemoteService")
4444
public interface IRemoteService {
4545

4646
@MethodName("getPid")
@@ -98,8 +98,8 @@ public class BindingActivity extends Activity {
9898
protected void onCreate(@Nullable Bundle savedInstanceState) {
9999
super.onCreate(savedInstanceState);
100100
mLinker = new AndLinker.Builder(this)
101-
.packageName("com.codezjx.example")
102-
.action("com.codezjx.example.REMOTE_SERVICE_ACTION")
101+
.packageName("com.example.andlinker")
102+
.action("com.example.andlinker.REMOTE_SERVICE_ACTION")
103103
.build();
104104
mLinker.bind();
105105

@@ -137,7 +137,7 @@ AndLinker supports all AIDL data types:
137137
You can modify the client side app's remote service interface, wrap the return type of the method.
138138

139139
```java
140-
@ClassName("com.codezjx.example.IRemoteService")
140+
@ClassName("com.example.andlinker.IRemoteService")
141141
public interface IRemoteService {
142142

143143
@MethodName("getPid")
@@ -163,19 +163,31 @@ new AndLinker.Builder(this)
163163
Define callback interface to receive callbacks from the remote service with `@ClassName` and `@MethodName` annotation.
164164

165165
```java
166-
@ClassName("com.codezjx.example.RemoteCallback")
167-
public interface RemoteCallback {
166+
@ClassName("com.example.andlinker.IRemoteCallback")
167+
public interface IRemoteCallback {
168168

169169
@MethodName("onValueChange")
170170
void onValueChange(int value);
171171
}
172172
```
173173

174-
Use `@Callback` annotation for callback parameter, and that's it!
174+
Use `@Callback` annotation for callback parameter.
175175

176176
```java
177177
@MethodName("registerCallback")
178-
void registerCallback(@Callback RemoteCallback callback);
178+
void registerCallback(@Callback IRemoteCallback callback);
179+
```
180+
181+
In your client app, implements the remote callback and register to `AndLinker`, and that's it!
182+
183+
```java
184+
private final IRemoteCallback mRemoteCallback = new IRemoteCallback() {
185+
@Override
186+
public void onValueChange(int value) {
187+
// Invoke when server side callback
188+
}
189+
};
190+
mLinker.registerObject(mRemoteCallback);
179191
```
180192

181193
### Specify directional tag

0 commit comments

Comments
 (0)