Project

General

Profile

How to get a Wt web app into Android/iOs App Stores?

Added by Stefan Bn over 1 year ago

I'm thinking about the way to go with my Wt developments within the next year(s).

For the mobile part, it would be great to get onto the users smartphone as an android or iOS app (rather then using the stock-browser and having the user to insert/bookmark/qr-scan the target URL). The user would tap the app icon and the app with native-feeling opens and shows the Wt web app content.

Traditionally this would mean something like "just write an wrapper-app with a simple webview, that shows your URL/content". Several sources on the web describe that those kinds of apps mostly get rejected from app stores nowadays.

I saw hints to frameworks turning everything into an progressive web app (PWA) or native app and use this. It would be great not to have extra development efforts for that and every mobile target plattform.

Has anybody here experience with all of this, especially in the context of turning a Wt WebApp into an App-Store App?

I think the "fun-part" beginns when it comes to technical aspects like authentication, push-notifications etc.

Thanks,
Stefan


Replies (5)

RE: How to get a Wt web app into Android/iOs App Stores? - Added by Matthias Van Ceulebroeck 4 months ago

Hello Stefan,

I'm getting up to speed on missed entries here, so I apologize for the very late reply.

I personally do not know any clients that do this. I also asked some others here, and that hasn't been a use-case so far.
A specific client I work with has asked before for an app (to which we suggested a PWA). We haven't done much investigation on it, but it seems to fundamentally go against how Wt handles rendering and updates.
We don't immediately see it fit within Wt's design.

That said, we have not had cause yet to look at this in more depth, but I don't foresee that will happen soon either. Should we do so at some point, I will try to remember updating this topic.

Best,
Matthias

RE: How to get a Wt web app into Android/iOs App Stores? - Added by Stefan Bn 4 months ago

Thank you Matthias, I do understand and appreciate your statement!

The question about going to app stores wasn't specifically targeted to the Wt-team, nor do I expect changes to the Wt-Framework in this regard. :-)

Just for anyone who is interested in this topic:

In the meantime I did a lot of studying and developments using the Capacitor framework, which turns any web-app into Android/iOS apps. The communication between web-app and native phone features is done using Javascript, which works well with Wt's Javascript-functions. I do have a first working protoype as Android app which performs great, but I'm still far away from being in app stores ..

https://capacitorjs.com/

RE: How to get a Wt web app into Android/iOs App Stores? - Added by Matthias Van Ceulebroeck 4 months ago

Hey Stefan,

that sounds very interesting! Could you give me a high level overview on how you approach this?
Are you retrieving DOM IDs and then sending them to Wt's backend, essentially recreating the framework's requests? Or calling the framework itself in some way?

It seems to me fairly hard when Wt would need to insert new element into the DOM tree, to correctly handle (or rather mediate?) those requests.

RE: How to get a Wt web app into Android/iOs App Stores? - Added by Stefan Bn 4 months ago

Could you give me a high level overview on how you approach this?
Are you retrieving DOM IDs and then sending them to Wt's backend, essentially recreating the framework's requests? Or calling the framework itself in some way?

I'm using Capacitor's web-view just as any other regular browser web-view, rendering all the HTML/CSS contents using standard Wt-features. All the communication with Capacitor is done using Javascript calls/responses.

From C++/Wt I just call Capacitor's Javascript methods straight using Wt::WApplication::doJavaScript(), e.g. to persist information into the phone storage, open the camera, display toast-messages etc.

To receive events from the native-app, I've built a small wrapper/bridge in Javascript, that sends signals from Javascript using Wt.emit() and the corresponding JSignal connected to my C++ methods that react upon those events, e.g. when the phone's back-button was pressed.

For taking pictures using the camera, Capacitor responds with the location of the image data URL in the phone storage. From Javascript I determine the Wt display-widget using document.getElementById("WtHtmlTxt"); and just assign the URL to the innerHTML to display the taken image, which works fine.

By the way, there is one aspect of Wt that would help greatly with the integration of those current frameworks, it's the feature support for ECMA 6 Module Javascript Files:
https://redmine.emweb.be/issues/12111

;-)

RE: How to get a Wt web app into Android/iOs App Stores? - Added by Matthias Van Ceulebroeck 4 months ago

Very interesting Stefan!
And honestly a really interesting use-case. We've had a client ask us about integrating React widgets, which we proposed to do in a similar manner, namely wrapping the widgets, to ensure that React can reach the Wt framework and essentially becomes a mediator. So likely it would have been similar to your approach with Wt.emit() and JSignal.

I appreciate the subtle nudge, I am not completely familiar with modules, and would have to do a bit of digging to see if it can be easily integrated or would require a more custom approach. It does seem like a good candidate for an improvement in 4.11.1.

Best regards,
Matthias

    (1-5/5)