Talking to remote CouchDB server from Android - java

I'm designing a turn based game similar to Words With Friends. I don't need the data to be stored persistently on the phone in a local CouchDB.
I've attempted HTTP requests using HttpPut/HttpGet and HttpClient with no success.
What is the best way to communicate with CouchDB from an Android application? What alternative database backends are available?

I would recommend TouchDB-Android. We've been using TouchDB-iOS for our iOS apps and are planning on using TouchDB-Android when we start Android development. TouchDB has an active development community -- see this google group. You can use TouchDB to connect to a local or remote CouchdB database and to replicate between the two.

Related

connect and communicate between Windows application (c#) and andriod apllication (java)

I am trying to connect and communicate between Windows application and andriod apllication. I have used .Net Socket but it is only appllicable for windows. how can i code in andriod application using Java programming language and make communication between two seperate devices (windows and andriod).
I want windows application act as a client and andriod apllication as a server. The server receives the data from client, processes the data and returns the result to the client.
Thank you all in advance
There are several ways to connect and communicate between a Windows application (developed in C#) and an Android application (developed in Java). Here are a few options:
1/ Use a web service: One option is to create a web service that both the Windows and Android applications can access. The web service can be hosted on a server and both the Windows and Android applications can send HTTP requests to the web service to retrieve or send data. This is a good option if the applications need to communicate with each other over the internet.
2/ Use a local network connection: If both the Windows and Android applications are on the same local network, you can use a local network connection to communicate between the two. For example, you can use sockets to create a connection between the two applications and send data back and forth.
3/ Use a shared database: Another option is to use a database that both the Windows and Android applications can access. You can set up a database server and have both applications connect to it to retrieve and store data. This is a good option if you need to store large amounts of data and need the data to be persistent.
4/ Use a cloud service: There are also several cloud services that allow you to easily connect and communicate between Windows and Android applications. For example, Google's Firebase provides a real-time database that can be accessed by both Windows and Android applications, as well as other features such as push notifications and authentication.
It's worth noting that each of these options has its own set of pros and cons, and you'll need to choose the one that best fits your needs.

Host database using Android phone

Here is the current scenario:
I have two(2) Android phones.
Android Phone 1 as the server phone.
Android Phone 2 as the client phone.
Here is what I want to do:
I want to create an Android-based app (E.g. Student Information app) where it will have basically two (2) modes:
Server - for adding, editing and deleting data on a local database.
Client - for viewing data from the database of the server.
The app will be installed to Android Phone 1 and set to Server mode.
The app will be installed to Android Phone 2 and set to Client mode.
I want to ask these questions:
I want to locally host the database of the Server app, so that Client app will be able to view the data. Is this possible?
If yes, how can I do it?
Note:
I am currently a web developer so I know that connected on the same network is a requirement.
I have implemented the same concept on a medium business where the web-based system is locally hosted so that computers on the same network can access it.
Suggest everything that you want to suggest, except the disadvantage of doing this concept. I am aware of some obvious disadvantages based from my research and willing to face the disadvantages provided that I will be able to implement the concept.
Rooting the phones is an option.
I want to accommodate small-sized business that is why I want to use Android phones rather than using Desktop Computers/Laptop.
I have read similar suggested questions here based on my title.
We have done the exact same thing in my company. The way we solved this is that the server exposes a service using the Android NSD API, so the clients (using the same API) can find it on the network. And after a client has connected to the server, the server sends its database file (yes, the .db file in /data/data/...) to the client via OutputStream. When the client receives the entire database and checks for its integrity, it copies it to its own /data/data/... and restarts part of the app.
Android NSD

Saving data from android app to remote server

I am just a beginner in android app development and that's why I have many doubts. I am building one application where the user enters some data in editText. Now I want to save that data in my database. My database is running on my laptop. How would my app connect to the database? Do I need a web server in between? If yes then which web server is used for Android apps? Basically, i want to know the flow of data from app to the database.
Study more from Udacity.com, its free.
You may use a jdbc Connector to connect to database.
Connect your jdbc connector over local network ip\servername and database connection string
You can use REST Service when it comes to web Service on Android like this. You can either pass the values as parameters or an Object depending on your requirement. All the best
Wamp server is best option to play with server related utilities.You can use it even if you are offline. and it provides various option for data storage. It Mainly uses MySql and PHP scripts for fast performance.
For More details Click Here

Connect Android App on a PC-based database

I'm creating an Android App that would have to access a database on my PC. I know how to program in Java and access a MySQL on my PC using JDBC ODBC. Could anyone lead me to the right place?
android don't support jdbc.
why don't you make a application-server?
the architecture is this.
Android <<--(using REST/JSON)-->>Application-Server(including JDBC or ODBC) <<-->> Database
using json or rest is good to reduce data traffic.
and generally the application server is faster than Android device.

Questions about servers, databases, and android

Ok so I'm trying to develop a server for an android app that I'm developing.
Basically it's an application that needs to connect with other phones through a database system.
I was thinking of using an sql database to store the simple data I need to exchange.
What type of server should I be using?
What language should I be writing the database code in (if besides SQL)?
How do I get the android application to communicate and exchange information with the database?
Is there a type of virtual server I can use to test my app?
The server type and language choices very much depend on your skillset and environment. However, I'd suggest exposing queries to your database either through JSON or XML, and presenting through a web server.
PHP & MySQL are as good a choice as any, as you can run the same code on UNIX, Linux, Solaris, or MacOS servers. Of course, using a J2EE environment with JDBC drivers to a generic server is also a good choice, especially if you need to share any classes between Android and your server.
By 'virtual server' I assume you mean 'virtual handset', in which case the Android emulator in the SDK might be good enough (although it is painfully slow), or just use a real Android device plugged in to your development machine.
Hope this helps,
Phil Lello

Categories