Your Friends Seem Remote
At this point, the Patchy project should compile cleanly. It will not run,
though, without the corresponding service.
Step #6: Implement the Service Side
Finally, we need to make similar sorts of changes on the PostMonitor service.
First, modify TMonitor/AndroidManifest.xml to add an (so
Patchy can reference it from another process and package) and add the
INTERNET permission that JTwitter will need:

package="apt.tutorial.three"
android:versionCode="1"
android:versionName="1.0">









Next, change our binder object from being an instance of LocalBinder to
being an instance of an IPostMonitor.Stub anonymous inner class instance
as follows:
private final IPostMonitor.Stub binder=new IPostMonitor.Stub() {
public void registerAccount(String user, String password,
IPostListener callback) {
Account l=new Account(user, password, callback);
poll(l);
accounts.put(callback, l);
}
public void removeAccount(IPostListener callback) {
accounts.remove(callback);
}
};
208
Subscribe to updates at http://commonsware.com
Special Creative Commons BY-NC-SA 3.0 License Edition
Précédent

- 241/447

Suivant