CouchDB Replication to and from Android - android

I'm new to Android and CouchDB and have a few questions.
Is it actually possible to replicate the contents of a Windows CouchDB database to Android without developing some sort of app?
CouchApp is installed on my Motorola Defy and it says CouchDB is running on http://ip:port/.
With the build in browser I cannot verify that information, because the URL cannot be opend (neither from the phone nor from my pc), but http://localhost:port/ works fine.
I tried setting bind_address in /sdcard/Android/data/com.aranomurl.couchapp/couchdb/etc/couchdb/local.ini to 0.0.0.0 and to the actual IP, but neither one changes anything.
Using the futon replicator I get the error message "Replication failed: could not open http://ip:port/".
As a correlating question, I wonder how continous replication is supposed to work for mobile devices, since IP address and port seem to change very frequently.
(edited once to clarify that mobile futon's URL is not working)

0.0.0.0 will listen on all interfaces so it will be accessible as long as your device is, Generally on devices its a good idea to pull from the phone as opposed to push to it, then you dont need to worry about the port switching.
right now your android and windows machine cant talk to each other, this could be a variety of problems related to your local network, when you can access the url that is displayed in mobilefuton, then your replication should be fine (replicating against a public host is also an easy way to get started)

Problem solved with newer CouchDB App for Android https://market.android.com/details?id=com.daleharvey.mobilefuton
Built in [continious] replication is working fine...

As mentioned earlier, the problem is solved in the newer version of the app.
But just incase replication doesn't work,
Make sure you have the couchdb port open and accessible universally/within the network in which you want to access.
Try initiating replication from Android to Remote server always, because, as you said, Android's IP might be hard to track down and keep static!

Related

.NET Web service (asmx) which is back end for Android devices does not serve devices from the same IP

Here is the deal... I have created a web service (asmx) which is running a long time consuming procedure in a class and returns the result. The web service is served in my local windows 10 IIS connected to the router with port forwarding. The android device connected to the same router (as the iis) accesses the web service in IIS with the outside IP (my router's IP on the internet - for checking purposes). I noticed that the first device accessing the service is served ok but the second delays big time to be served. Checking the net I found that there is a restriction in serving devices from the same IP. I disconnected one of the devices from the WLAN and everything worked as a charm. Both devices were served in the same time. How can I overcome this problem?
Thanks in advance
Searching the Internet I discovered (there are huge chances that I may be wrong) that this might have to do with the default behavior of DotNet framework which locks the session to the first in first served device:
ASP.NET application to serve multiple requests from a single process
and
Android http connection - multiple devices cannot connect the same server
I suppose that my IIS assumes that the attempt to hit the web service from the second device is another attempt by the same device. I also suppose that it assumes the device to be the same device since it is the same application with the same internal environment hitting the web service and it can't tell that they are two different devices. I tried to reproduce this error and check if I am right by hitting the IP reporting page in IIS from two different tabs of the Mozzila Developer edition browser but it works ok (so I am not sure if it is a session issue). I also found a report that the issue is present only in android devices but it was not clear enough if the server was IIS... The solution mentioned was "incorrect flag on the tcp kernel settings - Reuse connection". Does it tell anything to anyone of you?
If the session lock is indeed the problem is there a solution to make IIS distinguish that there are two devices indeed? Is there a setting in IIS that would change this default behavior of DotNet?
I am sure there is a solution (if indeed the issue is session lock) because I uploaded my code to an on-line server and it works perfect when hitting it from two Android devices. So either it is not a session lock issue or there is a setting that it changes this behavior of DotNet in IIS... Is anyone aware of such a setting?

Unable to record an Android app using JMeter

I'm trying to record browser activities of my Android mobile in Jmeter as explained here. I'm done with all the above settings, but Jmeter is unable to record the traffic.
Is it like, mobile and laptop should be connected to same internet source (wi-fi) or is it like laptop should be made as a hotspot and the we need to connect mobile to the hotspot?
Also, please let me know if anyone has done any other settings than the one mentioned above?
Yes, Mobile device and laptop need to be on the same network in order to have the mobile device use the laptop as an HTTP proxy. You should also turn off cell data (plane mode on an iPhone) to make sure you're not trying to connect via the cell data.
Most of the native android applications fail to connect once the proxy is set , Same goes for few sites as well, The solution is to either manually add API's to the jmetre and test or most probably the connections setting in the application configs needs to be changed in order for jmetre to record the script , This basically seems to be SSL issue and is to secure the apps from accessing data on proxy.For more detail blaze metre documentation shall help
https://guide.blazemeter.com/hc/en-us/articles/360000285357-Recording-Using-Android-Devices-Recording-Using-Android-Devices

Is there a way a browser can directly talk to android application?

It seems there is an initiative from Google to directly send the map directions from Chrome to Android device. I was wondering is there a way browser can communicate with directly an Android application, where the Android device is connected to the system by Cable. This will be helpful in some scenarios where the user does not have access to Wifi, and he wants to download the data to the mobile phone.
You use the Android Intent invocation that is available in the Android browser and demonstrated in here.
The problem that you will face is that not every app supports the ability to be opened from the Web Browser. This also relies on the fact that you are on the same machine and doesn't solve your "cabled" issue. You will also have to know how to exactly integrate with these Android apps, and that is not something that they often expose.
For a few reasons there is often no direct access to local files/devices from inside a browser. When cabled, you can forward a tcp port of the android system to local system, using Android Debugging Bridge(adb).
So you can send some commands/data to the device by setting up an application in android who listens to particular tcp port, and forward the port to local system. Then all access to the local port is forwarded to this application. Then with such techniques like jsonp, your browser can communicate with your device.

Android, HttpListener

I'm fairly new to Android so my question is how do we create an HttpListener on Android device? My task is to create a listener on one android device and request a contact number from second android device & send the data back n forth. Can any one help me?
E.g:
Android Device 1 (Containing Listener)
Android Device 2 (Client)
Requesting Url to Android Device 1: http://192.122.1.2:8888/GetContactDetail?id=2
Response Received: "111111111111"
Any suggestion on how to implement this scenario?
You can try using i-Jetty to run an a webserver on your first device: http://code.google.com/p/i-jetty/
If you have never created a web application before, you can do the development on a laptop and get your second device working with it. Then deploy the application onto i-jetty when its ready.
In practice this won't work since most networks (mobile and wifi) use NAT. NAT prevents inbound connections to device, which basically means that you can not run servers on mobile devices.
Your approach would only work if both devices are on same local network.
Update
You need to embedd a http server into your app: http://tjws.sourceforge.net/
This is what I did, thanks to #elevine suggestion, I was able to do it successfully but as suggested by #Peter Knego the limitations are still there. This will work on LAN without any problem.
Hope this helps someone.
http://codersapprentice.blogspot.com/2011/09/android-integrate-jetty-server-in-my.html

client server android app

i have developed an android application in android sdk 2.2 . This app is having tomcat server connectivity as well as mysql database connectivity. this app is running fine on emulator.
but for deploying this app on android device do i need to configure any settting??
Not particularly, if you have it working in an emulator. But why ask this on StackOverflow? Just go out and try it on a device. Also be aware that client network connectivity is frequently slow, error-prone and sometimes nonexistent, so make sure you're handling network issues gracefully.
EDIT: The comment below would indicate this is actually a duplicate of Access dev machine localhost via usb, although the original wording is pretty unclear.

Categories

Resources