Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can Xamarin be used to wrap a web app as if it were a native app for Android?

Say I build a super mobile friendly web application that I want in the Play Store for Android users to be able to download.

Could I use Xamarin to:

  • Wrap the entire mobile app as a single WebView
  • Register for mobile push notifications

Essentially shortlining an MVP of an android app by using an existing web app? If so, is there any well-known process or documentation that demonstrates this?

like image 215
SB2055 Avatar asked Oct 29 '22 10:10

SB2055


1 Answers

Probably the best approach for you would be using Xamarin Forms with one or more pages containing only web views. I don't love Xamarin Forms because usually for me Xamarin Android+iOS gives a better result in similar time, but your app would be so simple that doesn't make sense to do it with Xamarin Android.

Make sure that your web app will show only what makes sense to be shown in your app, otherwise you risk to see double header/footer, useless buttons... but if the website is yours adding a few parameters to change a bit the UI won't be a problem I guess.

Have a look at this example:

https://github.com/xamarin/xamarin-forms-samples/tree/master/WorkingWithWebview

Another approach is the use of Razor to build your pages in html directly inside your app, but if I understood well it's not what you need:

https://developer.xamarin.com/guides/cross-platform/advanced/razor_html_templates/

like image 144
Mauro Piccotti Avatar answered Dec 28 '22 22:12

Mauro Piccotti