couchdb android,CouchDB on android 入门

FAQ – Developing on android

How do I access CouchDB on my computer

$ adb forward tcp:5985 tcp:5984

Will let you access CouchDB via http://127.0.0.1:5985/_utils

How do I view the CouchDB / Console logs

$ adb logcat

Something broke?

That isnt a question, but please email me at dale@couchbase.com with as much information as possible. The output from $ adb logcat is extremely useful.

How do I build CouchDB for Android myself?

You dont need to build CouchDB yourself to program against it, but if you really want to then there are instructions on the CouchDB wiki

Much thanks to Matt Adams.

How do I use CouchApp to push to my phone?

The same way you push to any other CouchDB, you need to have set up forwaring first, my .couchapprc file looks like:

{

"env" : {

"default" : {

"db" : "http://myname:mypass@127.0.0.1:5984/couchnotes"

},

"android" : {

"db" : "http://com_arandomurl_couchnotes:pass@127.0.0.1:5985/couchnotes-org_android_couchnotes"

}

}

}

I tried to create a database with name X and it doesnt exist?

You cant directly create databases as they may conflict with other applications, your databases will be created with your packagename appended (with periods replaced by underscores) so the database created for CouchNotes is names couchnotes-com_arandomurl_couchnotes

How do I find out the credentials to CouchDB databases?

When you create a database you provide a password, a user is created with the username being the package name of your app with periods replaced with underscores (for example com_arandomurl_couchnotes) and they are set as admin on any databases you create.

CouchUtils.java provides a readOrGeneratePass function to help generate and store a password, you can find the generated password by running:

adb shell cat /data/data/com.myname.myapp/files/com_myname_myapp.passwd

Click on the menu button while futon is open and select Admin Password

Is my data really secure?

No, although the SDK provides seperation between applications, currently Android CouchDB stores all data on the SD Card of your phone due to the size of the data. Other applications can access your data directly though the SD Card.

I want a native app, not a CouchApp

The process for building a native application that uses CouchDB is exactly the same, just include libcouch-android as a library to your project, ICouchService.aidl are the functions you use to control CouchDB

How big is CouchDB? / CouchDB is too big for my app

Currently CouchDB is around 17MB uncompressed (about a 10MB download), There is a lot of work being done to reduce the size for both downloading and runtime memory footprint.

How do I use my own CouchApp

$ couchapp push --export > filename.json

Will produce a json file that can be loaded into Couch, the ExampleCouchApp.java will look for a json file in the assets folder for every database that is bootstrapped.

How do I access Geolocation etc from my CouchApp?

PhoneGap is a library that allows you to access native API’s via Javascript and is an excellent compliment to CouchDB on Android.

How do I publish my App?

CouchDB Reloads when I change orientation

Android by default will destroy your activity when your phone changes orientation, you can use

android:configChanges="keyboardHidden|orientation"

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值