Is there a way to use native input interfaces in a PWA? - progressive-web-apps

Each operating system has its own standardized input interfaces -- for example, on iOS any dropdown typically looks something like this:
Is there a way to tap into this UI from a PWA, or is this for native apps only?

You can use a standard html select. When safari takes over on iOS it should automatically use the native UI for selection. You cannot modify it however.

Related

Wear OS 2.0 - Is there any way to process html, web page, programmatically?

I can't seem to find ANY information on Android Wear OS and html. My end goal is just to show a simple web page with buttons for IOT control. I have all the backend already. I know I can use other views but my backend dynamically creates a page of buttons. I'm open to other ideas for dynamically building an interface. I know webview isn't supported. I found crosswalk-project but it's no longer maintained and seem too complex for my needs.
GeckoView might be a good starting point https://firefox-source-docs.mozilla.org/mobile/android/geckoview/consumer/geckoview-quick-start.html
https://searchfox.org/mozilla-central/source/mobile/android/geckoview_example
But it probably won't be a great experience.

Trimming Phonegap when not using any native features, is it possible?

I'm developing a simple lightweight webbapp which I intend to wrap as a Phonegap app for iPhone and possibly Android.
The thing is, I don't actually use ANY of the native features available via Phonegap, such as the camera or GPS. Do you know any ways for me to trim Phonegap so that I can have an app which is as light-weight and fast as possible?
For example, can I trim or even leave out phonegap.js? Any objecive-c code or resources that can be dropped?
Alternatively, does anyone know of some other bare bones webview wrapper which is lighter than Phonegap to begin with?
Thanks
Yes, it's possible. You likely can leave out phonegap.js, or at least substantially trim it.
PhoneGap provides two distinct sets of capabilities:
Provide a set of JavaScript APIs to access native capabilities
Wrap a set of HTML assets into a native application
For Android, #2 is completely implemented in phonegap.jar. #1 requires the addition of phonegap.js. Thus if you don't need the APIs, you don't need phonegap.js. I haven't tested on IOS, but would expect it to be a similar story.

Can I programmatically access a smartphone's sensors through the browser and JavaScript?

Is it possible for me to programmatically access a smartphone's sensors (e.g. accelerometer, compass, etc. on an Android or iPhone device) through a browser webpage and JavaScript? I know that the W3C Devices standard can allow access to the camera.
HTML5 is likely to contain a sensor API. Until this is fully standardized, vendors provide their own APIs such as Apple does for mobile Safari.
There's no need for full blown solutions like PhoneGap or similar if it is Ok for you to restrict yourself to a specific vendor/device. If not, frameworks like PhoneGap provide you with a unified, device independent API.
You should be aware of the Performance constraints that apply to Javascript applications running inside the browser of a mobile device. Depending on your type of application and the amount of processing you intend to do on the sensor data, you are better off writing a native application
See https://developer.apple.com/library/safari/iPad/#documentation/SafariDOMAdditions/Reference/DeviceMotionEventClassRef/DeviceMotionEvent/DeviceMotionEvent.html for some reference documentation.
The answer is both "yes" and "no". Each phone manufacturer/OS combination behaves as it sees fit here - for example, the GPS on an iPhone can be accessed, but the compass not:
accessing iPhone compass with JavaScript
You can use something like PhoneGap to do this, I believe.
Check out this chapter called "Controlling the iPhone with JavaScript" from the book Building iPhone Apps with HTML, CSS, and JavaScript
This demo considers the iPhone movements on the three axis using the event.accelerationIncludingGravity object:
http://www.omiod.com/iphone/acceleration-demo.php
So far Safari on iPhone is the first to implement it, but I see Android filling this gap very soon.

Does iPhone provide any API for inserting menu selections into e-mail, SMS and Addressbook context menus?

The Blackberry APIs allow one to insert custom menu items (and corresponding event handlers) into their standard email, SMS and Address book context menus. Is there any supported way to do this with iPhone APIs?
No, Apple doesn't provide these kinds of hooks. However there are some tricks I've seen - one example is what Twitterific does to tweet pages that you are viewing in Safari, via Bookmarklet which uses a Custom URL to launch Twitterific.
Perhaps you can do something similar by having a text containing a custom URL. I've never tried this but it's worth experimenting with.
As of SDK 3.1.2, no, that's not possible. In fact there's very little you can change! There's not even an easy way to change the colour of the title bar!

What KML fields are supported in the native Google Maps application on the iPhone?

I have been doing some research on using maps in iPhone applications and it looks like most of my needs can be met passing KML data into the built-in google maps application, but I cannot seem to set the same values (phone, home page, address) that are available when performing a built-in search in the maps application. Does anyone know if there is any way to set those values, or what fields are available?
UPDATE: With the advent of the 3.0 OS and the Map API, applications no longer need to pass control to the built-in map application, so this question is no longer relevant.
KML is not officially supported by Apple as of now. It's specified in the URL schemes documentation. Any URL in the ?q= parameter will be ignored.
There are few options available for iPhone developers planning to use Google Maps in their software. I've seen sample code and implementations of WebKit that translates gestures to Google Maps loaded inside it, but performance is dismal at best. Doing a static map without a lot of zooming or scrolling is pretty much the only performance-preserving option until a native API is available.
Take a look at Developing Virtual Earth iPhone Applications with Objective-C