Ask A Question

Notifications

You’re not receiving notifications from this thread.

Native Mobile Options

Brent C asked in General

I have a Rails 4 app that is fully responsive and works good on the mobile browser. However, I want to make native apps for it for iOS and Android.

What are some recommended steps? Is Phonegap a good option still? Are there any great resources/posts/tutorials/books on taking a rails app and making an API for mobile?

What are some next steps that people/solo devs follow?

Reply

We just built an IOS app using turbo native in Rails 7.
https://turbo.hotwired.dev/handbook/native

You may be able to upgrade rails and take advantage of the new turbo framework. Here's the GitHu repo for IOS:
https://github.com/hotwired/turbo-ios

And here's android:
https://github.com/hotwired/turbo-android

This allows you to create a native app (in our case Xcode) from web views in rails without heavy lifting in Swift. The turbo native lib wraps the remote views in native layouts and interaction/behavior. Not only that you have some control over your app from the rails side after it's deployed. After people pick up Hotwire a bit more I wouldn't be surprised if this becomes the standard for Rails -> mobile. It's surprisingly easy and powerful. Most of your work (like ours) will be on the rails side, not Swift/IOS.

Reply

I think most people have opted not to build a native app that's just a mobile browser because it doesn't provide a great experience.

That said, it's still the easiest way to go. I believe if you use something like Phonegap, you probably do not need to do as much with regards to building APIs. You basically just need to store the session cookie around so next time you launch the app the user is still signed in.

If you'd like to go the full native experience, you will have to do a lot more work with building the apps and the APIs to support them.

Are you leaning one way or the other?

Reply

I was thinking about starting with the path of least resistance. Then releasing an improved native experience once I learned more on what the customers needs were. I have not fully developed any native mobile applications so my thought was that a Hybrid using Phonegap could provide me with the training wheels with a quicker release cycle. BUT... That being said, if the Phonegap experience is terrible I rather just put in the time to go fully native. I'm all ears if you have a suggested/recommended pipeline.

Reply

I think if you're shooting for something simple as a start, Phonegap and related options should work pretty well for you. I don't think they're awful experiences and they've gotten quite a bit better over the years. It's definitely worth a shot because your time investment will be so much smaller than trying to build a full API and native mobile apps.

From a quick google search, I found this and he builds a basic Phonegap app for a Rails app in under 15 minutes. Not too bad if you want to experiment with it and see what you get.

https://www.youtube.com/watch?v=LjIKElAP6_A

Reply

Thanks Chris I'll check it out and report back.

Reply

Ok, after further review the Phonegap option didn't work for my given application. That being said, I am looking into Rubymotion. However, first things first I want to learn more about building a Restful API using JSON API to interact with. Poking around now to find the best resources for this.

Some resources.
https://robots.thoughtbot.com/welcome-aboard-youre-riding-ios-on-rails
https://www.airpair.com/ruby-on-rails/posts/building-a-restful-api-in-a-rails-application

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 79,047+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

    © 2023 GoRails, LLC. All rights reserved.