Android Couchdb - libcouch 和 IPC Aidl 服务

发布于 2024-10-15 06:16:19 字数 1926 浏览 12 评论 0原文

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

这是一个基本应用程序,如果 CouchDB 服务(如果之前安装过,则与 CouchDB 一起提供),则安装 CouchDB 不能被绑定到。

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

请参阅方法“attemptLaunch()”,地址: CouchAppLauncher.class 对此进行审查:

public void attemptsLaunch() {

    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 来自市场。这是因为它实际上永远无法绑定到 CouchDBService。 据我了解auf AIDL生成服务接口的目的,实际 打算向其他应用程序提供 IPC 的服务应该使用 AIDL。在这种情况下,AIDL 已被移动 到尝试绑定到远程服务的应用程序,在本例中为 libcouch。

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

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

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

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

原来分手还会想你 2024-10-22 06:16:20

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

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

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

CouchAppLauncher 的源代码应该可以帮助您了解如何使用该服务,我也将很快发布一个教程

谢谢
戴尔

I replied in an email but to reiterate for anyone here.

The libcouch library is included into the core CouchDB application as well as to be used by client applications so the CouchDB Service does include those aidl files.

The reason you have probably been able to consume the service is that there have been 2 versions of CouchDB on the market, there was an old version without any service, and a new one (that has been invisible to 2.1 users). Tonight the Updated CouchDB app has been republished for 2.1 users and the old version removed.

The source code of CouchAppLauncher should help you see how to consume the service, I will also be publishing a tutorial shortly

Thanks
Dale

聚集的泪 2024-10-22 06:16:20

为了完整起见,我认为有人提出了一个非常好的 教程:)

And just to be complete, I think Someone put out a very nice tutorial for couchapps on android:)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文