android device not getting data from local server - android

When testing my android app on an emulator I can get data from my local MySQL server database using an httpconnection. However, when testing the app on my samsung phone, I cannot get data from my database. Is there some parameter I need in my manifest file or does anyone know what I need to do to be able to get data from my local server onto my samsung phone?

Well i think you can't access the local database from device.
If you want to access on device you should host your database online and internet should be connected to access that url and then you can probably access it.

Related

Why can I show data in emulator from MySQL database but not retrieve in on phones?

I retrieved data from MySQl database. It is shown in the emulator, but not on the device.
Please tell why this problem is happening and how I should solve it
Your emulator can easily access database which is in mysql and through xampp server. because your xampp server is available only for your computer. if you want to make it accessible to all devices then you need to put your databse to server.

SQLite database sync over usb via PC [duplicate]

I am unable to figure out what is the best way to achieve a scenario like this:
Working on a project that would have android application as client.
User will take their device with the android application installed to field/visit and capture/punch/key data through out the day. This data would be stored locally on the device in SQLite database.
The data captured in SQLite needs to be exported out and imported into the desktop app (it could be java or .net based) for further processing.
Other points:
A. User could connect the phone via usb to desktop.
B. data flow would always be in one direction (i.e. Phone to Desktop).
C. No internet connection on the phone
My dilemma is how to access the sqllite database programmatically in desktop application? Are there any JDBC drivers that could read data from the sqlite database from a device connected via USB to the computer?
This is just a way to do what you want, there are more ways to do it but from my point of view is the most accurate and scalable.
You would have to make a webservices server on Java, PHP, etc ... with a database MySQL, MongoDB, etc ... and so the mobile device is synchronized with the database that was the cloud.
Thus after a desktop client would connect to the webservice to bring the data in order to process it on your desktop client.
EDIT:
You can view this post's
send-data-from-android-to-pc-via-usb
transferring-data-usb
bi-directional-data-transfer-through-usb-between-an-android-device-and-a-pc-mac

Android JDBC connector

I'm developing an app that inserts data into database without using any webservies. I've created a database on my notebook with MySQL workbench. I am able to insert data into the database using emulator, but I cannot insert data into the database using my phone.
I have changed the path from
jdbc:mysql://10.0.2.2:3306/ with jdbc:mysql://xx.xx.xx.xx:3306/
xx.xx.xx.xx is from ipconfig of my localhost machine. I've tried again with emulator and I'm still able to insert data, but when I try with phone I cannot. What could be the reason?
You can't access a MySQL DB from Android natively. EDIT: Actually you may be able to use JDBC, but it is not recommended (or may not work?) ... see
Android JDBC not working: ClassNotFoundException on driver
Android cannot connect directly to the database server. Therefore we need to create a simple web service that will pass the requests to the database and will return the response.
See this tutorial:
how-to-connect-android-with-php-mysql

Connect an android application to sql server in real device

I wrote an application in android which will sync with SQL-server database that is sitting on my Local Server.
i used web service to connect my apllication to my database and it works perfect in local. Now i want to test it in real device "Samsung" but it gives nothing !
Any suggestion please. Thank you
When you say Local Server, do you mean the database is on your development machine and NOT the phone? You are not using SQLLite for storing data? Usual practice is to use SQLLite (or any other data storing techniques like SharedPreferences or Files) in android but all the data is stored Locally on the device. If you need server side storage, then you need to provide an interface (for e.g. web service) that the phone can talk.

Android Development : Connect Android application to Mysql DB - No data returned on real device

I'm new to android and I've created sample application that retrieve data from MySql DB (through PHP script) ..and its working fine on android simulator but my problem is when i tested the application on my mobile device there is no data retrieved !
I think this is because my DB on localhost so what is the correct way to retrieve data from my database to real device ? Is there specific IP should i use for this purpose ?
knowing that I've used WAMP server to create mysql database.
Any help is highly appreciated .
I think the easiest way is to host your database on a free database hosting site and connect to that.
You can try http://www.000webhost.com/free-mysql-hosting (Havent tried it but have heard it works)
Other free services:
http://www.frihost.com/
http://www.freesql.org/

Categories

Resources