What features do Progressive Web Apps have vs. native apps and vice-versa, on Android
TL;DR - As of Feb 2017, Progressive Web Apps are a sufficiently powerful platform that Twitter has moved all of their mobile web traffic to a React PWA.
As of August 2016, Progressive Web Apps actually offer more hardware access than commonly thought. Here's a screenshot of whatwebcando.today from my Chrome 52 stable on Android:
Hardware access includes
- geolocation - supported in the vast majority of browsers
- camera and microphone via the getUserMedia/Stream and the upcoming MediaStream Image Capture APIs
- device vibration
- screen orientation and accelerometer access, including compass and gyroscope
- battery status
Upcoming hardware access
These features are being implemented or already work in some browsers:
- Bluetooth via Web Bluetooth API
- NFC
- ambient light sensor (works in Firefox 48+)
- proximity sensor (works in Firefox 48+)
- accelerometer, magnetometer and gyroscope sensor access
- shape detection API
Another important point to note is that the Origin Trials Framework (implemented in Chrome) enables manufacturers to expose and test hardware (or software) capabilities without having to go through the standardization process. For example, a phone maker could expose an API for reading the values of a pressure sensor, refine it, then submit it for consideration to the W3C.
Besides hardware access, there are also software features traditionally employed by native apps that are now available to web apps.
Traditionally native features that PWAs can also use
- push notifications
- working offline
- adding an icon to the home screen
- appearing in the apps list thanks to WebAPKs - Progressive Web Apps can now be packaged into actual installable Android packages!
- launching in full-screen
- clipboard access
hardware-accelerated 2D/3D graphics via HTML5 Canvas or WebGL - check some of the HTML5 Canvas demos, WebGL sites or the three.js library. A 2014 benchmark of the Unity cross-platform game engine compared native vs. WebGL rendering performance, and concluded that
"The most important takeaway is, while there are still areas where WebGL is significantly slower than native code, overall you can get expect very decent performance already, and this can only get better in the future."
The gap has indeed been closing.
- reading user-selected files in any browser
- slick, smooth UIs with 60fps animations
These features cover a lot of use cases, and many popular native apps nowadays could be rewritten as PWAs. Take Slack, for example. Its open source alternative, Rocket.Chat, is building a PWA version. For more PWA demos, see https://pwa.rocks.
Native-like features coming to PWAs
- handling intents — for example, sharing a page to another app, or being the share target, e.g. a PWA chat app that receives an image to set as the user’s avatar
Native Android features not yet available to PWAs
- access to the fingerprint sensor (under development)
- contacts, calendar and browser bookmarks access (lack of access to these could be viewed as a feature by privacy-conscious users)
- alarms
- telephony features - intercept SMSes or calls, send SMS/MMS, get the user's phone number, read voice mail, make phone calls without the Dialer dialog
- low-level access to some hardware features and sensors: flashlight, atmospheric pressure sensor
- system access: task management, modifying system settings, logs
Progressive Web Apps offer features that native apps lack
- discoverability - content in progressive web apps can easily be found by search engines but a content-centric native app like StackOverflow won't show among app store search results for content that it does offer access to, such as "pwa vs. native". This is a problem for communities like Reddit, which can't expose their numerous sub-communities to the app store as individual "apps".
- linkability - any page/screen can have a direct link, which can be shared easily
- bookmarkability - save that link to access an app's view directly
- always fresh - no need to go through the app stores to push updates
- universal access - not subject by app stores sometimes arbitrary policies or (unintended) geographic restrictions
- large data savings, extremely important in emerging markets with expensive and/or slow Internet access. For example, e-commerce website Konga cut data usage by 92% for the first load by migrating to a PWA.
- low friction of distribution - if your progressive web app is online, it's already accessible for Android (and other mobile) users.
- 65.5% of US smartphone users don't download any new apps each month
- PWAs eliminate the need to go to the app store, search for the app, click Install, wait for the download, then open the app. Each of these steps loses 20% of the potential users.
Final note: PWAs run, with the same codebase, on the desktop as well as most mobile devices. On desktop environments (ChromeOS, and later Mac and Windows), they're launched in the same way as other apps, and run in a regular app window (no browser tab).
Is there a way for PWAs to access the phone number of the host device?
No. PWA can't access the host's phone number. I'm not sure if you are saying or asking if PWA can access phone number if its accessed from home screen. Either case, PWA cant access the phone number.. even after installing/adding to home screen, its still limited to web standards and it can only do what web can do.today
You can implement with native code and pass on such PWA unavailable capabilities using secure web sockets to PWA socket client (from localhost WSS server in native ). we have some solution like that and it works fine.
Related Topics
Fragment View in Viewpager Is Not Restored When Resuming
How to Animate a View in Android and Have It Stay in The New Position/Size
Fragmenttransaction Animation to Slide in Over Top
Failed to Execute Tools\Android.Bat: Solution
Android: Textcolor of Disabled Button in Selector Not Showing
How to Change The Navigationview's Item Text Size
Why to Use Handlers While Runonuithread Does The Same
How Do The Android Support Libraries Work
Android Studio - Error:Program Type Already Present
Android Webview Jellybean -> Should Not Happen: No Rect-Based-Test Nodes Found
Read All Sms from a Particular Sender
Error Building Android Library: Direct Local .Aar File Dependencies Are Not Supported