Rest Android server interraction - sizzlelab/sensors GitHub Wiki

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

  1. Specify your server address in RestAndroid project using the file res/values/strings.xml property server_address

  2. add RestAndroid library to you Android application.

  3. Initialize RestAndroid library's object to prepare it for sending messages to the server: AndroidRestlet.init(getApplicationContext());

  4. When you sensor data updates call AndroidRestlet object to send it to the server. The data is sent in text String format AndroidRestlet.sensor.updateSensor("data");

  5. Configure server to receive these messages:

  6. In RestServerTest project edit file hibernate.cfg.xml to set up your database configuration (e.g. username, password, address, databasename)

  7. 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.