connecting android app to rails server - android

i am new into developing in general, so i am made a social network web application using ruby on rails but only in a localhost , and i made sign-up/sign-in form in an android app.
what i want is basically to have an online server that will have my website code and database and domain , and how to send the user data when signing up/in in the android app and sent some back too
Obviously, I am not looking for a code or a simple answer, i just want links or any useful resources to start with.
thanks in advance.

i'm not a RoR people, but if you want to communicate android to web, you need create a web api on RoR which handle signup, signin event and return json format. Then in your android app, you can use HTTP REQUEST to get or post data
http://www.androidhive.info/2011/10/android-making-http-requests/

Related

How can I connect the between web application with an application?

1) I have a web application. This web app is for a user to buy a point.
2) I have an android application for parking payment. Payment is based on point that user buy from the admin. Since I made two things which are web app for admin and android app for user, so I will have two database for each one right?
3) So, how can I transfer the point that user buy from the admin to an android application? Is this thing has to do with JSON fetch or pass data?
4) Basically I want the user to get the point from the web application? Your answer will be really helpful to me, thank you :)
The issue is design issue. Your mobile app and the web app don’t have to be two separate.
You can have one application with one database that both web and mobile point to.
If you’re using Android look into ionic framework that can help you code one codebase targeting both web and mobile.
See
https://ionicframework.com
https://scotch.io/tutorials/create-your-first-mobile-app-with-angularjs-and-ionic
You will have to build a single server for both your admin and your app. Both will have a single database that is controlled by your server. Your app will request the same server to redeem points and your admin will request the server to add points. You can use retrofit library in android for making api calls to your server
The web application and the android application must connect to the same database on the server. In the android application, to you get the data via json, you must use asynctask to download the server information or use libraries like Retrofit or volley that facilitate the handling of json.

Developing both Rails Web App and Android App that shares only one Database

I'm a 3rd year BSIT student who wants to pursue a career of Web Development in the near future. We decided for our thesis to make a Web App about a certain topic using Ruby on Rails since it's the tool that we used during our WebDev class. I've had several experiences and accomplished projects using RoR thanks to the help of this site.
Our Adviser suddenly suggested us to make an Android version of the app for the customer's side to utilize it's portability. what we would like to happen is the Customers can input and retrieve data through that android app from a database, on the other hand, the admin can also do the same using a Desktop Web App utilizing also the the same database used by the customers.
Is there any other recommendations of lightweight development and database tools that can help us make the desired Web App beside Android Studio and Eclipse? Much better if it can support Rails or Ruby.
Note: Also, we're planning to include a GPS feature where you can locate certain shops using the said android app
What you are looking for is an API. You have a Rails app, now you have to expose API endpoints from your Rails App which your Android App can access and send requests to.
I don't know if you learned about APIs yet but in short, you set up new links that retrieve information from the parameters and respond using either JSON or XML. Your android app will for example have a login form:
Name = john
Password = anything
When they submit the form, you take the name and password and send it using an HTTP request from Android to your Rails App.
#stupid example but this is how the link would somehow look like
http://www.your-site.com/api/login?name=john&password=anything
Your rails app should be setup to receive request via an API controller:
class ApiController < ApplicationController
def login
#authenticate user
#respond with json
end
end
Your Android app receives a JSON response from Rails, usually a status code telling Android that the authentication was successful or failed and then you have access to your Web App using Android but nothing is secure and you will have to setup tokens for each request, etc because API's don't have sessions like a browser. But since you are talking about a school project and not a production app maybe you can ignore the security part.
Read this blog post on how to build an API:
https://labs.kollegorna.se/blog/2015/04/build-an-api-now/

How to Save android app user data to server

Currently I am working on one android app which takes user's info and let them register for the app.
But I am having problem while connecting my backend with my app.
In order to save the data I use server host which I don't know how to implement for android users.
Help me with this so that I can start building my apps..
If you are sending basic user info, maybe you can publish a rest webservice on the server and consume it from android app. im using retrofit right now to consume rest webservices from android and is very easy to use.

How to link a website with an android app

I was wondering how can you link the fields of a website with an app. Like I have a college attendance website where we all check our attendance and then a student made an app on android where we login by entering the student id and password. So how was the person able to send info from the app to the website and get the information?? Thanks in advance! The website is www.websismit.Manipal.edu.
See you there are some ways as follows:-
you can make an android app having single activity with webview and
open your site inside the webview. you can also use html 5 and jquery mobile for that.
you can make an native application and using web-services you can
get/set the parameter result.
In thin client mobile applications, we generally deal with lot of data exchange between server and mobile app. Mobile app is nothing but a client. So in order to get/post data from server you have to write APIs.
Now writing restful API is your choice you can use any on the available language.
I believe your website is up already so just search and you can easily get ways to expose RESTful APIs.
There are different ways to identify client request, for that you should use Access Token to identify the clientID/UserID or whatever id you are maintaining.
For consuming API from android, you can refer to this tutorial.

Access Heroku database from Android application

I've built a Rails 4 web application with PostgreSQL database and hosted it on Heroku. The future plan for that database is to also be used by one Android application.
I am not completely sure how can I accomplish that. Do I need to build another REST application and host it on Heroku and somehow connect to the same database or there is another way?
How to connect with Android application to that database which is used by the web site? I know I can't connect directly.
Thank you for your guidance.
You don't need another app - just build an API for current one and then you can communicate from Android app to your web application (web app will connect to db and return data).
Have a look at Twitter API as example - you can access different resources and manage them via Twitter API
https://dev.twitter.com/docs/api/1.1
You can build something similar - create rails controllers that access your database and respond with structure you want - preferably JSON format of your models (or something custom if you need)
From Android app you can send request to your API and parse JSON responses - then process data your own way on Android app.
Don't forget about authentication between your Android app and web application - let only your Android app to use it.
I encourage you to browse internet for best practices 'How to create an API' :)

Categories

Resources