I gather from this page that it's possible to use the WebView framework build an Android web app that can then be run on the device without using a web browser.
My question is: is the same possible for iOS, possibly through the UIWebView object?
Notice that the link talk about:
You can make your web content available to users in two ways: in a traditional web browser and in an Android application, by including a WebView in the layout.
With this you can implement a javascript bridge and catch javascript event in android java contest.
iOS allow the same. UIWebView can catch javascript event and work with it.
The most cross platform sdk for mobile development use this feauture to realize the application in javascript and work it in a selfcontained webView.
Use this to start
Related
I would like to compare native with cross-platform technology.
I am writing Kotlin Android Native application and is it possible to easily open it in browser like Chrome and it will work similarly like web application in Flutter?
My goal is to write native application with possibility to launch it on 'normal' browser on computer.
Let's start with concepts
PWA
Progressive Web Application, as a summary is just a web with special javascript that make it possible the use of device(desktop/mobile) hardware features and/or css files with effects that make the web look like a native application. At the end is just a web application running a on remote server usually with a domain like www.acme.com and accessed through a web browser.
UI Form elements are just html
Native mobile application
It is an application, developed with java or kotlin for android and Objective-C or Swift for ios. Result is an .apk or .ipa containing usually non readable files. This kind of application cannot be opened using a web browser.
UI Form elements are native components, not html
Mobile web browser
In a mobile device we have web browsers like opera, chrome, firefox, safari, etc. As we can notice, this are native applications capable of open any web page through its url. This is the feature provided by mobile devices used in the hybrid applications.
Hybrid Applications
A hybrid app is a software application that combines elements of both native apps and web applications where the core of the application is written using web technologies.
As a extremely summary, this apps are a kind of web browsers opening just one url, without the address bar, which uses new device features to trick the user by displaying a website as if it were a native application
Usually the web application which is loaded in the hybrid applications are pwas or similar.
UI Form elements are just html.
Sources:
https://ionic.io/resources/articles/what-is-hybrid-app-development
https://www2.stardust-testing.com/en/blog-en/hybrid-apps
https://easternpeak.com/definition/hybrid-apps/
Your question
How to run Android Apps in a computer browser like PWA App?
No, you can't. If you app is developed on a native language (android sample)
Button btnTag = new Button(this);
btnTag.setLayoutParams(new Layout...));
btnTag.setText("Button");
btnTag.setId(some_random_id);
There is no way to open it in a web browser of the same device and much less on another desktop browser.
Workaround
If you application is a web with a valid url and you achieve to develop a kind of native app with features of browser (like WebViews for android and wkWebView for ios), but hardcoding the url and hiding the address bar , you will have:
a web able to opened directly any desktop browser
a native app able to be opened on any mobile phone.
Keep in mind that the look & feel of your web should be similar to a native application like Material Design for Angular or React. Also should have advanced features like service worker in pwa. Without them, your user will notice that is a web and not a mobile app.
Don't reinvent the wheel
The previous explained workaround is exactly what the following frameworks do but with steroids. The result app is called sometimes "hybrid applications". Basically you just develop html + javascript and the framework will package your code as a standard web, native .apk for android and native .ipa for ios. Here some frameworks:
Apache Cordova
React Native
Flutter
Ionic
Phone Gap
Unity (games)
Apache Flex
image source: https://www.statista.com/statistics/869224/worldwide-software-developer-working-hours/
I am looking forward to create an Android app with Kotlin.
But I can not use Android Studio or other IDEs. I am using the Amazon AWS Cloud9 IDE now.
I have found there is WebView and read articles, but I still cannot figure out how it works.
It is possible to emulate the UI on the web or is it only for web application development?
The WebView framework allows you to specify viewport and style properties that make your web pages appear at the proper size and scale on all screen configurations for all major web browsers. You can even define an interface between your Android app and your web pages that allows JavaScript in the web pages to call upon APIs in your app—providing Android APIs to your web-based application.
Consider using these alternatives to WebView if your app falls into the following use cases:
If you want to send users to a mobile site, build a progressive web app (PWA).
If you want to display third-party web content, send an intent to installed web browsers.
If you want to avoid leaving your
app to open the browser, or if you want to customize the browser's
UI, use Chrome Custom Tabs.
More details
We have a responsive web application for desktop users and it is working fine. My organization also has native android app. Now, the requirement is to integrate responsive web app with native android app (using webview). Same time, we are looking to access some native features of device like capture photo from web application.
We suggested to use phonegap but don't know how we can integrate phonegap javascript api with existing web application without creating phonegap/corodova application. Idea is that, user just hit the native app button and on listener it will invoke webview with webapp url. By checking user agent we will be able to load phonegap JS api and it will be able to access native features.
Issue is that, Don't know whether it is possible or not, if yes then how we can enable phonegap api in existing web app. Desktop and mobile user will get same experience.
Use WebView component of phonegap in your application, read documentation
http://docs.phonegap.com/en/3.5.0/guide_platforms_android_webview.md.html#Android%20WebViews
Is it possible to access android native code using javascript in the default android browser?
Regards,
Dom
No, sorry.
You can create your own Android app that exposes Java objects to WebKit through the WebView widget. Also, you can link to Android apps from your Web content displayed "in the default Android browser" (whatever that might be for the user). And, you can arrange to have an app that you write respond to URLs that otherwise might go to a browser. But that's about it.
I have a fully-working web app that is accessible using Android's browser.
The annoying part is the url bar uses a lot of the screen. Is there a way to make this web app a native Android app? I've read that webview can be used to embed a web site within the Android App.
Unfortunately, I only know web programming languages and have no Java experience. Will I still be able to do this on my own?
You certainly will need some learning in java, you can start with reading the following :
Webview documentation
A very detailled tutorial (quite hard if you haven't any java basics)
A basic tutorial on webview usage.
Have you looked at phonegap. It comes with a standalone app with a WebView embedded in it and with native android functionality support. You just need to provide your html/javascript app to it and you're done.
You can use a web app called MIT App Inventor
and get it done in less than 10 minutes, it's very easy, intuitive and requires no programming skills at all.
all you need to do is create a new project,
drag and drop a WebViewer component, on the right set the home url,
and your done! just connect to an android phone via USB to install the app
and you can even download the .apk to your computer, sign it and publish it on Google Play