GenericJam

GenericJam

Is there any interest in a mobile framework for Elixir akin to React Native or Flutter?

I am really interested but not sure about the right approach. I’ve done the steps here (this post is 5 years old so they have to be adapted a bit) to get Erlang working on an Android device although it’s currently only working through adb shell as the phone isn’t rooted which is the only way I can see I could run it with Termux. Not sure what the next step would be to get Elixir running on top of that but that’s the plan.

Maybe for graphics, etc we could look at Scenic.

I also thought about dissecting the build systems of Flutter or React Native to see if we could use a similar approach.

In the end I would like to have a component based systems similar to RN and Flutter. It makes sense to use something like Phoenix Templates for this.

I think Elixir as a language makes a lot of sense for mobile given its superior take on concurrency.

If I dare to dream I think we could think about things like code push in the future as well.

Does anyone have experience with getting beyond just building Erlang for mobile? I’d be interested to know what worked.

Showing Posts 14 to 5

GenericJam

GenericJam OP

For anyone coming here in the future the best bet is to use Elixir Desktop for mobile.

derek-zhou

derek-zhou

Actually I like the idea of Scenic. If we can do one super app together, than contains scenic, elixir, erlang and some native control all in one, so the community can distribute their own applet via hex.pm in source form. So this super app will access hex.pm, browse available scenic apps and download compile and play the app.

If we have that, before long we will have silly games mushroom all over!

GenericJam

GenericJam OP

I’ve been working in React Native for a while (too long)… I would like sort of a drop in replacement for that. It’s possible you need to be Facebook or Google to pull it off but RubyMotion gives me hope.

A similar vision that @boydm has for Scenic. It should work with or without a server.

Also, I definitely want the BEAM for the same reason you’d want the BEAM in embedded. That’s kind of the point. I want to be able to run an Elixir node on the phone.

boydm

boydm

Creator of Scenic

Yes. If you don’t need to change the aspect ratio, then that is the approach I would take.

Reading some of the other responses though, I (without knowing anything about what you are trying to build…) would look at phoenix/LiveView first as well. It might not fit the scenario tho!

GenericJam

GenericJam OP

I was in touch with someone that used to be involved in RubyMotion. Here’s their contribution:

I think the challenges are:

  1. Exposing the native APIs (ObjC/Swift for iOS and Java/Kotlin for Android) to Elixir/Erlang. For that, you might need the ability to interface at the C level from Erlang, and be able to export the native APIs (for the case of Java, you could do that using JNI, this is how I did for RubyMotion/Android). You will need a way to tell the native world in case you start subclassing things from Erlang. In RubyMotion, I fixed that by reusing the native object system to Ruby (so that a Ruby class would always be an ObjC/Java class), if you use an existing Erlang runtime you will need to work on a bridge.

  2. Being able to package the binary so that it can be submitted to the app stores. In the case of iOS, you will need the ability to code sign, and also you will need an Erlang runtime that does not JIT; last time I looked the official runtime has a simple interpreter? (So it might not be an issue.)

  3. Probably other things that I can’t think of right now.

If I had to do it, I would look for an Erlang runtime that’s not too big and can be embedded; I believe I saw a few projects but you surely know more. I would also look for a runtime that I can easily tweak, so that I could interface it with ObjC/Swift and Java (through JNI).

Seems doable albeit not easy.

derek-zhou

derek-zhou

So if I don’t need to change aspect ratio, can I dynamically change the scaling factor and center the scene and live with letterboxing or scrolling now?

ityonemo

ityonemo

I think if you built an elixir equivalent of React Native, a very many people would be interested! I would say the best approach (for now) is don’t try to get the BEAM on these devices, just take the LiveView approach; and figure out how to handle the “no-connection” situation later.

eahanson

eahanson

You could look at the approach that RubyMotion took. It’s a complete Ruby implementation on top of iOS and Android and compiles down to native code. You can use all the iOS or Android SDK and third-party libraries (depending on which platform your app is running on) plus all the Ruby standard library functions that were ported over, plus any cross-platform RubyMotion-specific third-party gems. I’ve written iOS apps in Objective-C, Android apps in Java, and iOS+Android apps in RubyMotion and I definitely prefer RubyMotion.

If you have a lot of time, you could try doing the same with Elixir :slight_smile:

boydm

boydm

Creator of Scenic

Well… there are two hurdles. I think the harder one is just getting the BEAM running at all. Although I haven’t paid too much attention over the past year (been working on a different port)…

After that …

I have a feeling the glfw driver might just work. Maybe? Decent odds of it

GenericJam

GenericJam OP

Hi Boyd! Thanks for chipping in. I really like Scenic. Kudos for that.

I know in Android and iOS you can query the OS for the screen size so this is kind of what I’m counting on. I’d be over the moon if this was the biggest hurdle. I suspect just getting it to work (reliably) will be perhaps the most difficult.

@boydm Where would you start with getting it to work? I see some positive indications using Android NDK as well as being able to use imported C libs (possible to bring the BEAM in?) in Android and iOS. There are also cross platform build tools like Boden.

Where Next? Top

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 94592 917
New
cblavier
Hey there, It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
heathen
Quite interesting article Google brought me. Didn’t find any mentions about it here. What do you think in general? Would you use togethe...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
AstonJ
Since we have deprecated our Erlang sections (as we have dedicated Erlang Forums now) let’s add this thread for those who’d like to post ...
New
Null-logic-0
What IDE or editor are you using for Elixir development? Personally, I use Zed, and I really like it, but sometimes I wish there were a ...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews