gpt4 book ai didi

Android Couchdb - libcouch 和 IPC Aidl 服务

转载 作者:行者123 更新时间:2023-11-29 00:48:35 25 4
gpt4 key购买 nike

我正在使用 Android 开发原生 CouchdDB 应用程序。就在本周,CouchOne 发布了 libcouch,被描述为“与 Android 上的 CouchDB 交互所需的库文件”: couchone_libcouch@Github

这是一个基本的应用程序,如果 CouchDB 服务(如果之前安装了 CouchDB,则随附),则安装 CouchDB不能绑定(bind)。

更准确地说,据我了解:libcouch 通过尝试从 CouchDB 绑定(bind)到 IPC 服务来估计 CouchDb 在设备上的存在并通过该服务与 CouchDB 进行通信。

请参阅“attemptLaunch()”方法CouchAppLauncher.class审查这个:

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();
}
});
}
}

我的问题是:libcouch 永远无法“找到”以前安装的 CouchDB。它总是尝试安装 CouchDB从市场。这是因为它实际上从未能够绑定(bind)到 CouchDBService。据我了解auf AIDL生成服务接口(interface)的目的,实际打算向其他应用程序提供 IPC 的服务应该使用 AIDL。在这种情况下,AIDL 已被移动到试图绑定(bind)到远程服务的应用程序,在本例中是 libcouch。

查看提交,AIDL 文件刚刚从该存储库移出到 libcouch。

对于完整的链接,这里是 Android CouchDB 资源的链接:github.com/couchone/libcouch-android

现在,我的发现可能完全错了,也可能是 lincouch 的 list 遗漏了一些东西,但我真的很期待得到一些答案!

最佳答案

我在一封电子邮件中回复了,但在这里向任何人重申。

libcouch 库包含在核心 CouchDB 应用程序中,并供客户端应用程序使用,因此 CouchDB 服务确实包含那些 aidl 文件。

您可能能够使用该服务的原因是市场上有 2 个版本的 CouchDB,一个是没有任何服务的旧版本,另一个是新版本(2.1 用户不可见)。今晚,已为 2.1 用户重新发布了更新的 CouchDB 应用程序,并删除了旧版本。

CouchAppLauncher 的源代码应该可以帮助您了解如何使用该服务,我也会在短期内发布教程

谢谢戴尔

关于Android Couchdb - libcouch 和 IPC Aidl 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4869097/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com