Beulah Akindele
Beulah Akindele

Reputation: 649

Can I use Ruby on Rails as a native Android backend?

I have a web application developed with RoR, and I was wondering if it was plausible to use it as the backend for an Android application that I would develop in Java or Kotlin?

For example, if the web applications authentication is handled with devise, can I get the Android application to send the name and password to my web application and have it return the user as a JSON?

Upvotes: 3

Views: 1065

Answers (1)

GregHNZ
GregHNZ

Reputation: 8969

Absolutely you can.

Usually the Android app would call an API rather than a web page. That is you don't exchange HTML like a browser does, just the essential JSON. Lots of things work the same as a web site. For example you can use the same authentication mechanism for the API as for the web-site.

This is a good starting point for RoR to create an API. https://guides.rubyonrails.org/api_app.html

Here's a starter for Android making a web-service call: https://developer.android.com/training/volley/simple

That's just a get, which you might use to get a list of something that's publicly available. It's probably worth understanding the other pages just there because with web calls it's really easy to do bad things like lock up the UI thread, so best to use the example patterns and methods.

Upvotes: 5

Related Questions