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.
Related
We are developing an application using Electron that joins meetings through WebRTC.
We want to know if it is possible to detect when a call from another application (Skype, Facebook, etc.) was received in order to disable the camera and microphone of our application.
Is there an event that we can listen when a call comes in from another application? Or can we know when another application is also using the camera or microphone?
Regards
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.
We have customers who need to be able to talk to a device connected to the audio jack. Our customers can do web development but not android development.
Our goal was to create an app that stood between the web app and the SDK that talked to the audio connected device. I have code that launches our android app and our activity. I need to be able to send data back to the web page that opened our android app; preferably with a callback to a JavaScript function.
I can't use a webview because it is the customer's site (would be used with many customers and their respective sites). I thought about using local storage but I don't want the web page to get "stale" data saved from a previous call to the application.
Is it possible for an Android app to execute a callback function on a web page that loaded the Android app via an intent link? I have been feverishly searching and I can't seem to find anything.
I have called functions in a page loaded in web view but it will be an external page calling our application and need to send information back to that page.
I have examined the Intent object in the activity and can't anything I can hook into.
I am developing a Windows 10 UWP App in javascript.
One of the requirement is to show a notification but only when the app is in background, not foreground.
My question is, what is the best way to check if the app is running in background/foreground, using javascript. Many thanks.
You use the same APIs you use from a Web page: Use document.hasFocus() to determine whether the app has focus. You will also receive the window.blur and window.focus events when you lose and regain focus.
what is the best way to check if the app is running in background/foreground, using javascript.
If you check the app lifecycle, you could use WebUIApplication.EnteredBackground Event and WebUIApplication.LeavingBackground Event to do judgement. For example, you could use ApplicationData.LocalSettings to store the states of current app. When the EnteredBackground or LeavingBackground event is fired, you could change this localsettings value in its event handler. Then, when you want to detect the app's states, you could get this localsettings value and do judgement.
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?