MySQL Forums
Forum List  »  PHP

How to interact with mysql user database from Android application?
Posted by: Yihan ZHANG
Date: April 30, 2017 01:13PM

I am working on a mobile application created by Unity3D(using c#) then exported as Android project. The application is designed to put sensors in a room with augmented reality then monitor and visualize data of each sensor. So for each user, I need to deal with two types of information: the Area Description File(for positioning indoor), and data of all sensors. The Area Description File is generated by my application, which needs to be stored in database, and the data of sensors is obtained by an uploading system and put into the database in real-time.

To realize this, I have made researches and now I'll roughly describe what I want to do:

(1) In my application, use login.php to authenticate user by comparing user information stored in mysql database table1 and then get user_id:

table1:

user_id, user_name, password, email
1, Tom, 123456, Tom@xx.com
2, Alex, 111111, Alex@xx.com

(2) With user_id, use get_ADF_file.php to make queries in table2 to get the Area Description File directory location, so that the user can download the Area Description File in the app.

table2:

user_id, ADF_file_id, ADF_file_directory_location
1, 1, download_link1
1, 2, download_link2
2, 1, download_link3

(3) Now that I have ADF file, the next step is to get all sensor data by using get_sensor_data.php to make queries in a particular table with user_id and sensor_id. For example, if the user_id is 1, the sensor_id is 2, then the queries will be made in table_1_2.

table_1_1:

user_id, sensor_id, time, data_value
1 , 1 , 0 , 10,
1 , 1 , 1 , 11,
1 , 1 , 2 , 12 ,
...

table_1_2:

user_id, sensor_id, time, data_value
1, 2, 0 , 5
1, 2, 1, 6
1, 2, 2, 8
...

Basically that is what I thought to interact with database from my application in a simple way, is that a possible way? Please tell me if there is something wrong and show me a right way to do this. Thanks!

Options: ReplyQuote


Subject
Written By
Posted
How to interact with mysql user database from Android application?
April 30, 2017 01:13PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.