Android Couchdb - libcouch and IPC Aidl Services
Posted
by
dirtySanchez
on Stack Overflow
See other posts from Stack Overflow
or by dirtySanchez
Published on 2011-02-01T23:17:23Z
Indexed on
2011/02/01
23:25 UTC
Read the original article
Hit count: 290
I am working on a native CouchdDB app with android. Now just this week CouchOne released libcouch, described as "Library files needed to interact with CouchDB on Android": couchone_libcouch@Github
It is a basic app that installs CouchDB if the CouchDB service (that comes with CouchDB if it was installed previously) can't be bound to.
To be more precise, as I understand it: libcouch estimates CouchDb's presence on the device by trying to bind to a IPC Service from CouchDB and through that service wants communicate with CouchDB.
Please see the method "attemptLaunch()" at CouchAppLauncher.class for reviewing this:
public void attemptLaunch() {
Log.i(TAG,"1.) called attemptLaunch");
Intent intent = new Intent(ICouchService.class.getName());
Log.i(TAG,"1.a) setup Intent");
Boolean canStart = bindService(intent, couchServiceConn,
Context.BIND_AUTO_CREATE);
Log.i(TAG,"1.b bound service. canStart: " + Boolean.toString(canStart));
if (!canStart) {
setContentView(R.layout.install_couchdb);
TextView label = (TextView) findViewById(R.id.install_couchdb_text);
Button btn = (Button) this.findViewById(R.id.install_couchdb_btn);
String text = getString(R.string.app_name)
+ " requires Apache CouchDB to be installed.";
label.setText(text);
// Launching the market will fail on emulators
btn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
launchMarket();
finish();
}
});
}
}
The question(s) I have about this are: libcouch never is able to "find" a previously installed CouchDB. It always attempts to install CouchDB from the market. This is because it never actually is able to bind to the CouchDBService. As I understand the purpose auf AIDL generated service interfaces, the actual service that intends to offer it's IPC to other applications should make use of AIDL. In this case the AIDL has been moved to the application that is trying to bind to the remote service, which is libcouch in this case.
Reviewing the commits the AIDL files have just been moved out of that repository to libcouch.
For complete linkage, here's the link to the Android CouchDB sources: github.com/couchone/libcouch-android
Now, I could be completely wrong in my findings, it could also be lincouch's Manifest that s missing something, but I am really looking forward to get some answers!
© Stack Overflow or respective owner