3

i have a rails application running awesome with few controllers on a vmware on linux platform.Now i have a table User with columns as firstname ,lastname and mobilenumber.now i have also developed an android app that have fields same as in users table which will be filled by the user.How can i connect to the rails server(localhost) and INSERT/SELECT/UPDATE the database when the user submits the data from android app.i have few questions,even after googling alot and goinging through many suggestions:-

Community
  • 1
  • 1

1 Answers1

2

Your android app can communicate with your Rails server through HTTP

  1. If you run your rails server in localhost, get your local ip address and use it as the end point for all the call from your Android client. Your android client and your rails server must be in the same local network to be able to communicate with each other

  2. To start implementing HTTP in Android, can use this tutorial http://www.vogella.com/articles/AndroidNetworking/article.html You may want to check out Android Network Library such as DataDroid as well.

  3. Download Eclipse or Android Studio for your Android development, they both come equipped with emulator for Android

Ethan
  • 1,616
  • 14
  • 8
  • thanks ethan,the info in the link is good but how can i insert/select from the database...??? –  May 27 '13 at 08:28
  • The database is in your rails server. In order to communicate with your Android client you will need to write controllers which can process HTTP requests from your android client. – Ethan May 27 '13 at 08:34
  • 2
    The tutorial here would help you to write you rails server http://ruby.railstutorial.org/chapters/static-pages – Ethan May 27 '13 at 08:35
  • thanks for the info ethan,my ruby on rails project is working great and the link above just mentions core Ruby on rails implementations,more over there are many books such as **The rails way 3** and **Rails in Action** that i have went through entirely but they dont seem to guide on connecting to remote service using **HttpResponse/HttpRequest.** –  May 27 '13 at 11:05
  • I'm glad it helps :D. Please mark my answer as the correct answer for your question. – Ethan May 28 '13 at 01:56