Web page and mobile app using the same code


#1

I’m curious to know if anyone has had experience building a web page and mobile app using the same code base. By this I mean building an adaptive UI where you can compile it as an Android/iOS App but also able to build is as a web page. What approach and method did you use? Any recommendations?

I’ve read the following page: https://ionicframework.com/docs/developer-resources/desktop-support/ and understand that you can enable/disable calls to native APIs based on the condition if(this.platform.is(‘cordova’)) but I’m more interested in how to build the app as a production web page. Can it be compiled AOT just like a pure Angular project? Any input on your experience is welcome.


#2

ionic build generates a plain web project in www that can be deployed as a website.


#3

That simple? I’ll explore that this morning. I’m also studying the idea of building the whole thing as a Progressive Web App but my app makes use of push notifications and from what I understand, the adoption rate on iOS is very slow and does not allow for that function yet.


#4

ionic build already is or can be a PWA.
And yes, some APIs are not available everywhere yet. This will improve in the coming months I hope.


#5

The pleasures of programming with cutting edge languages. :wink: