-
Notifications
You must be signed in to change notification settings - Fork 1
Rest Android server interraction
There are two projects in the repository:
RestAndroid - provides connection and data exchange with the server. Links your application that gathering sensors data with the server. RestServerTest - gets data from the Android phone using REST protocol.
How to use
Specify your server address in RestAndroid project using the file res/values/strings.xml property server_address 1 add RestAndroid library to you Android application. 2 Initialize RestAndroid library's object to prepare it for sending messages to the server:
AndroidRestlet.init(getApplicationContext());
3 When you sensor data updates call AndroidRestlet object to send it to the server. The data is sent in textString
formatAndroidRestlet.sensor.updateSensor("data");
in 4 Configure server to receive these messages In RestServerTest project edit filehibernate.cfg.xml
to set up your database configuration (e.g. username, password, address, databasename) 5 Launch server application in RestServerTest project running fi.soberit.ubiserv.MainServerComponent.java as a java application. The application automatically creates tables in the database if they do not exist hence it will happen on the first start when the message is received.