Need help with communication between the server database and the Android application

advertisements

I am developing an Android based app that does both the things:

  1. Add data to the server.
  2. Fetch data from the server.

Data consists of a multimedia file which can be either:

  1. Picture + Some info about Picture
  2. Video + Some info about Video
  3. Simple Text + Some info about the text

In the above, info consists of things like Latitude, longitude, user name etc.

I want to know as to how to achieve the desired ?

I have been suggested to use JSON based object and pass it to the android app. I know how to parse the JSON object but have no idea about things like:

  1. How does the android app running on mobile device requests for JSON object ? (meaning which URL to ask)
  2. How to pass the multimedia object (Picture/Video) from server to App in form of JSON object?
  3. How to send data from android app running of android based phone to the server ?

Thanks in advance !


Let me try to answer your questions;

  1. You need to have a service running on the server. Android parses the json and sends it to this service. So you will need to use the URL of your service.

  2. You can pass multimedia objects to the service by converting it to a Byte or Base64String.'

  3. With regards to how to parse the json and send it to the server, I'd recommend you look at google-gson. This is one of the most commonly used libraries when working with JSON

Look into this link for a more indepth tutorial on Json parsing Note: While JSON is the recommended way to pass objects to and from the server, wsdl is another option you can use.