Server-Sent Events does not work on Nexus 7 webview with Android version 4.3 - google-chrome

I'm now using Nexus 7 for my project which is using Server-Sent Events to get alert message.
On Nexus 7 Chrome browser, it works well.
But when I load the same page using webview, it does not work (saying "your browser does not support server-sent events...").
The source codes are exactly the same as [http://www.w3schools.com/html/html5_serversentevents.asp].
I think there maybe some difference between Chrome browser and Android Webview.
Could some one tell me how to make it work using Android Webview?

I think WebChromeClient is the one you need anyway. I am using both WebViewClient AND WebChromeClient because the latter one is full HTML5 enabled.
So in your Android WebView you can use BOTH Clients at the same time.
For instance
// clients
webView.setWebViewClient(new CustomWebViewClient(this));
webView.setWebChromeClient(new CustomWebChromeClient(this));
I use WebChromeClient for all the fancy stuff, like Javascript popups and yes, SSE using PHP scripts.

Related

StageWebView - Change system browser

Running StageWebView on a Windows Desktop machine, uses IE as it's browser, no matter what is the systems default Internet Browser. Is it possible to change this to Chrome?
I'm not interested in the built in Webkit browser in AIR
Sorry but the answer is no, the StageWebView class on mobile or desktop uses the OS provided web control to display content on the Stage:
On desktop computers (in the desktop and extended desktop profiles),
the StageWebView class uses the system web control provided by the
Flash Player plugin.
Thus on Windows that would be Internet Explorer (IE) via the IWebBrowser2 interface which Google's Chrome does not support.
Note: This is assuming you are passing true for the useNative parameter on the StageWebView constructor, otherwise the on Windows/OS-X you would get the old built-in Webkit version. This can be checked by seeing which user-agent is used (try http://whatsmyuseragent.com or similar to verify)
Air 18 (or 19 beta results in same rendering) on Windows and OS-X:

How can I cast an HTML page with the Google Cast Chrome extension?

I'm building a simple web application that I want to be able to display on a TV screen using the Google Cast SDK, the Chrome browser and a Chromecast. I know with the Chromecast extension for Chrome Browser, I can cast a tab to a Chromecast device, which, from my laptop works perfectly. However, I want this exact same functionality, but available from iOS devices (iPads and iPhones) running the Chrome Browser.
It seems since Chrome v36 the Cast ability is baked into the iOS versions of Chrome. I have pulled in the Google Cast SDK per these instructions: https://developers.google.com/cast/docs/chrome_sender. I am able to get my iPad to connect to the Chromecast, but when I try to pass in a URL to a web page...
var mediaInfo = new chrome.cast.media.MediaInfo('http://google.com');
var request = new chrome.cast.media.LoadRequest(mediaInfo);
session.loadMedia(request, onMediaDiscovered.bind(this, 'loadMedia'), onMediaError);
I get an error...
invalid_parameter
I have found other, somewhat dated examples, saying I can build a custom Cast Receiver that holds an iFrame and renders the page in there, but I do not want to build a custom Cast Receiver.
Can I accomplish this with just a Cast Sender?
You always need a receiver on the chromecast; that is what gets loaded there. In general, you can either use a default/styled receiver or a custom one. The Default or Styled receivers can only handle media so you are left with the Custom option and having an iframe is the way to go.
Chrome on iOS doesn't support casting. There's a post from early 2016 saying this on the google product forums. (But my reputation is too low to post more than two links).
If it DID work, then all you would need to do is go to this site and choose the ChromeCast option and press Launch after typing in your website. This does work on Chrome on desktop.
The source for this sender/receiver is here: https://github.com/boombatower/chromecast-dashboard
I've used the boombatower.github.io receiver with my own code as sender in an iOS app. I'm also looking at whether an app extension would work, but I suspect not because of app extension limitations.

Does IndexedDB work with a hybrid android app?

I've developed a todo web app using localStorage. However, my new extra functionality, clicking on selected date and getting that day's todo items requires to have a Date object linked to the todo items, so that a specific day's todo items can be retrieved. I'm skeptical about the approach at this point. WebSQL is deprecated but has good support on Android browsers. Since my target app is for an Android browser, WebSQL should work fine. Does IndexedDb work with Android browser? I understand that WebSQL works, but is it future safe to use something that is deprecated? How does Cordova deal with it?
IndexedDb only works on Android 4.4 and up, so if you are also targeting older devices indexedDb isn't enough.
I use a polyfill for older android devices, see link: https://github.com/axemclion/IndexedDBShim
This way I can use the indexedDb support on newer android devices and fall back automatically on the older ones. The fall back uses websql!

can a google chrome extension flash an OS style alert?

for example, growl flashes a message in the upper right corner regardless of which application is running. Skype makes the icon in the dock have a little red dot with a number of new messages. Is there anyway to write a chrome extension to have this type of functionality? that is, I want to write a chat system that works in the browser but also notifies users when they have closed my site's tab, or even when chrome is not running.
I could write a native client in addition to my browser based client, but that's double the work. (Tripple the work if you bother with a native window's client vs. just OSX but who would do that?)
Chrome can create "Desktop Notifications" See the Documentation
It's also possible to have the notifications visible when chrome is closed providing you create a "background process". this question/answer might point you in the right direction.
Chrome supports the text-only version of the W3C desktop notification standard. Chrome deprecated the HTML version about a year ago and will stop supporting it very soon. Any webpage viewed in Chrome and any Chrome extension can use this API.
The Rich Notifications API is available to Chrome extensions and packaged apps. As of today, it's dev-channel only and is iterating rapidly. It has implementations on ChromeOS and Windows, with Mac on the way. Linux currently delegates to the W3C implementation. The API is not a 1:1 replacement of W3C HTML desktop notifications, but it does provide many layout options for common use cases.

A universal cross-platform way (mobile) to show alerts to a user

I have a task to create a client application which can show notifications to a user with a high probability of notifications being noticed.
The application should work on Android (2.0+)/iOS/WP.
Here is the use case:
The user starts the Application and performs some Action. Then he switches to the home screen/another application.
The response to the Action makes the Application to issue a notification. The notification is noticed by the user disregarding of what another application (or home screen) he uses on his mobile device at the moment.
There is no requirement for the application to be a native app or to be a web browser-based mobile app. The notification could be a sound or a vibration on the device, but I know that accessing the vibrations from within a browser is still tricky.
Here are my research results of making universal sound/vibro notification mechanism so far:
it seems that making a mobile device vibrate from a browser works only in mobile Firefox (no iOS, no WP);
the support of the audio html5 tag is still experimental, it doesn't work on each and every browser/device;
the sound alert from this example works only in mobile Firefox (asks for a plugin to play an mp3 sound), the Android browser just remains silent.
So, the question is:
Is there any way to force a user of a mobile device (Android 2.0+/iOS/WP) to view a notification from a mobile application? Is the only way to do this is to write a native app for each mobile platform?
I would propose PhoneGap for that particular problem.
Among other things it features cross-platform alert, sound and vibrator notifications.
Only quirk for Windows Phone 7 is that the Cordova lib includes a generic beep file that is used. You should consult the Notification reference page to make sure if it can help you.