i have an Android app that needs to access offline a MySQL database that's hosted on my localhost (i'm using WampServer).
i can't use USB tethering or port forwarding because my laptop won't have internet connection too.
what can i do?
You can setup wifi, connect your system which contains server and your android device to same wifi. Assign a static IP to your server system and let your android connect to that server's MySql through the IP you assigned. Basically it is nothing much different then your web api and db hosted on cloud server and your android application connect to that cloud using either the domain or ip.
Related
I want to learn client - server communication in Android. As per my understating, to communicate with the server we need a valid URL. My doubt is that, can I communicate Android mobile client with the local xammp server???? If yes, please explain me...
Thanks in advance...
yes you can do that if you are using android emulator then use http://10.0.2.2 ip address to access localhost, for genymotion use this http://10.0.3.2.
You can also use Google Chrome's port forwarding but you need google chrome on computer and emulator or device.
if you want to access localhost using port forwarding then open following address on google chrome chrome://inspect and enable port forwarding and set port and ip address.
I have configured openfire server on my laptop running windows7. Pandion and Spark desktop clients are working fine on the localhost. Tested it thoroughly with multiple users.
Laptop is connected to a wifi network.
I am trying to connect to the localhost openfire from Xabber client installed on Samsung galaxy pop running Android OS. Mobile is connected to the same wifi network.
http://localhost:9090/login.jsp?url=%2Findex.jsp
I am able to access this admin url in mobile browser.
But none of the xmpp clients are able to connect to localhost openfire.
Configuration done-
server- localhost
port- 5222
username and password are exactly same as provided in Spark desktop client.
It would be great to know if someone has the solution.
Thanks.
You cannot use localhost in the android client to connect to your laptop. And i do not believe that using localhost in an android browser would connect to a server on your laptop. You have to use the local ip address of the server to connect. Often something like 192.168.#.#.
I'm designing an android app that communicates with a web server. Till now i was hosting the server on my localhost and was accessing it with 10.0.2.2 on the emulator. Now I need to access a server hosted on the company's network PC vserver36 with address 192.168.1.124. How do I do this on the emulator?
You have just to use the address 192.168.1.124 instead of 10.0.2.2 ;)
How do I connect an Android device to a PC, laptop, or server?
I have finished my Android program using Eclipse. I also use a client - server system (I'm using MySQL, not SQLite, to store my database)
when I run my program in emulator, it runs nicely (using CustomHTTPClient with address to connect MySQL is http://10.0.2.2/android/blablabla.php)
But, will it be the same code to connect to a MySQL database when I deploy the app onto a real device? if no, what should I do to connect the device to my database(MySQL) in my PC/Laptop/Server? How should I change the code?
I don't use Bluetooth because the distance is too short.
You could use your computers IP address. Find this by tpying 'ipconfig' into the command prompt. Look for and use your IPv4 address, it should be similar to:
192.168.0.XX/android/blablabla.php
You just have to make sure that the Android phone is connected to the same network the PC/Server is in and replace 10.0.2.2 with the ip address of the Server. I assume that you don't have a domain.
i have an android application works on emulator and connect to server localhost , send an receive data, i want to make my application on real mobile and connect it to localhost via wireless, i am using servlet to connect from mobile android emulator to localhost server, what is the changes i have to do? and can I connect to localhost via wireless or i have to buy a real host?
Firstly, check the URL and change the IP address from that of the local server to local IP address. Make sure that the mobile device is in the same network with the computer to access the script that fetches the API. Then service the request to get the results in terms of Javascript Object Notation (JSON).