Can I create an Android view using native widgets with JavaScript? - javascript

I know that you can create an app with a WebView and attach a JavaScript interface to it, but is there a way that I can define an Android layout from the web? Perhaps even when the user is accessing my site from the Android browser, not just from a custom app?
For example, let's say I have a website with a form on it and tab navigation; could I have my site send a custom layout.xml file using Android's tabhost, buttons, and textfield views?

Related

How to use js bridge in chrome custom tab

Google oAuth is not supported in android webView. Google recommends to use chrome custom tab for proceeding oAuth. I have also requirements of js call from my web app to native. How to configure to call native methods from web app using chrome custom tab in android similarly like js interface in webView?
Update 1
This mod Chang marked the post as duplicate but the post is different. I don't want to run any JS in my web app from native. I want to invoke method from web app to my native code via JS interface. Is there any way for CCT?
Based on Can I Inject Javascript Code into Chrome Custom Tabs the answer appears to be no.
Chrome Custom Tab is based on Chrome itself and has the same security model. The web content is only allowed access to the Web APIs (camera, device orientation, etc.) and has no access to the native app. At best the native app can capture a URI.
Even the Chrome Custom Tab documentation state that the way for a native app to handle content:
Some URLs can be handled by native applications. If the user has the Twitter app installed and clicks on a link to a tweet. She expects that the Twitter application will handle it.
Before opening an url from your application, check if a native alternative is available and use it.
Implies that either a native app handles a URL or not. My interpretation of Chrome Custom Tab is a skinnable Chrome component adjacent to the native app rather than internal to a native app like a WebView where a Javascript bridge exists.
Your desire for a Javascript bridge from a web app would mean that there would be a arbitrary way for any website code to interact outside of the web container. The rational as to why that is not allowed is given as the responses in the first link.

Adding website action link to android native share widget?

Is there a way to add a website action link to native share widget in Android without developing an app as shown below?
Android Share Action Item:
Simply need user to capture the data (url) from any app on android and post it to my url for processing without needing a new app to do this?

convert HTML5 to mobile app and use pop out messages

is it possible to convert web (social)network made in HTML5 to mobile app? And then enable pop out messages for android and iOs?
If not, what would you suggest?
I'm trying to make some kind of social network and I'm having trobles deciding how to do it. I'd like to make an app and put it on app store or i-store. I know how to do it with html5 and java script, but I don't know how to convert it in to app and give it function of a pop up messages.
you can search for progressive web app(PWA) development which enables you to do this

It's possible to call an android app content provider from a web page using javascript?

I'm searching about how to expose some functionalities from my android app to a webpage using content provider.
My app stores digital certificates in AndroidKeyStore, i'd like to list this certificates on a webpage using js.
You can do a native app, in java and c++ or an html app with cordova or similar. Content provider belong to native app world. If you need to work with them, i suggest you to build an native app (in java) and do user interface natively.
The best way to do it is using Android WebView and exposing some functions to javascript.
https://stackoverflow.com/a/10389678/2004555

JavaScript global keyboard hook

I wonder if it's possible to make a contoller for web music player. Some desktop players use hotkeys to pause/play so I don't need to open app and press pause. Can I somehow do this stuff with web player? My idea is to make a global hook and then do stuff. How can I do this?
Webapps run in a sandbox so you can't create global keyboard hooks. That requires native code (dlls, exes, etc). You can catch key events from the window object since javascript events usually bubble up to the parent but this would only be while your page is the active page.
A workaround would be to create the keyboard hook as native code & then talk to it via your web app. Say your keyboard hook dll could start a web server & your page could communicate via that web server. Or implement the hook in a browser addin that sends custom events to your web app.

Categories

Resources