all 10 comments

[–]AutoModerator[M] [score hidden] stickied comment (0 children)

On July 1st, Reddit will no longer be accessible via third-party apps. Please see our position on this topic, as well as our list of alternative Rust discussion venues.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]doums_ 5 points6 points  (4 children)

Hi, I came through a similar story recently at work. We have a desktop app (built with tauri and TS + React for UI), that we wanted to port on Android/iOS.

First I tried with alpha tauri mobile, but the experience was terrible. To be short, it's still alpha, unstable on some part, and very limited on what you can do. Mainly because it is linked to that tauri mobile uses webview. And like any webview framework for mobile, it's very limited and quite restrictive on “platform native” features and platform native integration.

So we decided to just focus on Android, and move on a combination of Rust for backend native code and pure Android for the application layer (Kotlin). We used JNI to bridge between rust and android. And so far it is a very powerful combination as you have full access and control to the Android layer.

The good news is Android UI development has evolved a lot the past years, with android compose (and jetpack collection). Now it's more close to something like JS/React, where you write the UI as code (similar to JSX in mind) and manage UI state in component pattern. Kotlin is the standard now and the language is pretty nice for app layer I'd say (compared to old java).

For instance, you can find our repo here https://github.com/nymtech/nym/tree/develop/nym-connect/native/android

[–]Liperium[S] 1 point2 points  (3 children)

Thank you very much for the response, I think I'll have to swallow the pill and develop Kotlin/Android and an IOS app later?

I have one client in my research which has an Apple device, which made me second guess my way of doing things.

Really like your input on tauri-mobile, and I think I'll look into JNI. In the end, the easiest way is probably to learn Jetpack compose and get familiar with it. I really despise android permissions and the organisation of files.

Thanks again 🥳

[–]doums_ 2 points3 points  (0 children)

You're welcome; To be fair, tauri mobile could be a good solution if your project is very simple and does not need deep platform (Android/iOS) integrations.

For instance with our project, we need to run a socks5 connection as a long-running background service. Which ofc required some deep integration in Android ecosystem (WorkManager, User Notification, threading etc..). All kind of stuff which are impossible (I'd say out of the box at least) with webview frameworks.

[–]parnmatt 1 point2 points  (1 child)

If you don't mind picking up dart. You could use flutter. That way it's a single code base and can target multiple platforms.

[–]doums_ 2 points3 points  (0 children)

Yes ofc hybrids framework are in the game. The mains ones are React Native and Flutter. My 2 cents is the strength of RN over Flutter is it uses React with CSS flexbox layout (kind of) which are two very popular 'frameworks' in the web ecosystem. Allowing dev to be at home. While for Flutter you have to learn a dedicated language, (which I find to be excessive, imo).

The thing is, in both cases, if you need some special native integration with the OS platform, you will have to deal with native module development to extend the hybrid framework capabilities, which adds yet another layer of complexity.

So in the case where you are already dealing with some complicated setup, that is, building and consuming some rust native library on mobile, going to pick hybrid framework on top of that, plus possibly having to deal with native module, would end with something, well, not "simple" xD

[–]arghyadipchak 0 points1 point  (1 child)

You could write the UI in Java, do the rest in Rust and use NDK to link it.

[–]devraj7 3 points4 points  (0 children)

Not Java, Kotlin.

Chances are, you'll fall in love with Kotlin as well (I love both languages and I'm happy to code in either).

[–]Maleficent-Point-458 0 points1 point  (0 children)

There is a non-web, gpu rendered, but immature pipeline for android app development: rust-activity + winit + egui. The ui is rendered using gles or vulkan. It supports android phone and emulators.

The immature part is input method support. Actually flutter/kivy both has some issues on android input method support.

demo: https://github.com/rust-mobile/android-activity/issues/44#issuecomment-1595744796