Can I Build Bluetooth connectivity into a HTML5 / JS WebAPP - javascript

I have a WebApp built using HTML5, JS, Jquery - but I'd now like to build some Bluetooth functionality into it in order to transfer data to another BT enabled device.
I've downloaded the Bluetooth Dev Kit and read a lot of the papers, but seems that the tools available are for Native Apps.
Can anyone advise if there are BT Group approved libraries or add ins that I could use for the purpose.
Thanks
Phil

In practise, in 2016: No.
Support for the Web Bluetooth specification is practically nil.
Only Blink based browsers support it, and even then it is locked behind a user preference that defaults to off.

Related

Is it possible for Chrome to communicate with external devices?

I work developing advanced browser based applications, using technologies like WebGL to create training and simulator tools.
Is it possible for such applications to access and interact with external devices connected to the Windows/Mac? If so what options are there?
A good example is: say we're creating a simulator for a surgical robot which is operated using a special joystick-type control. In a desktop application we could create a controller which has USB (serial port in the old days) and write custom code to interrogate this. But I don't know if browsers have any way to do the same.
In the days of plugins you could write a C++ plugin which acted as a bridge to the browser sandbox but this is not really an option in modern browsers.
What options exist, please? Our target is primarily Chrome though it doesn't have to be.

webview for user interface in android

I was searching for how to use swf file in android and most of the answer suggested me to use webview and an simple html file.
Now i think We can easily put css and javascript files in asset folder and then we can use them in an html5 code.
Looking at the power of HTML5, This will make app development for a web designer very easy job !
I just want to know that is it good to use this approach to build a good user interface in android ? Are there any technical pros/cons behind it ? will i miss some features provided by android ?
There are a lot of frameworks that allow you to write native android applications using HTML/CSS/JavaScript only. Here some of them :
PhoneGap
Cordova
Titanium
I've never used any of them, so I can't say if it's good or bad idea to write android apps this way, but here you can find a good session about it HTML5 versus Android.
There are pros & cons of using cross platforms. As per my point of view you shouldn't go for loading of everything in WebView.
I still recommend you native app approach because of following points :
WebView is one of the UI control in Android SDK. So, it will have
limitation of memory size and working with CPU utilization. So, you
might face performance issues in some devices.
As you know in older era we were used to work with desktop apps and after that everything is shifted to web-application.
It was
possible only because our browser(s) gets more features for e.g. more
memory area, CPU access, threading, individual Processing (like
google chrome) etc...
in-short, web browsers gets more smart and get treated as separate application. Now a days web-application can have mostly similar
performance as desktop apps. So, everything is now shifted to
web-application development.
This era will come in to Mobile development in later stage. but currently we are in middle stage of Mobile development and Cross platform development. So until and unless Web-View control of any platform (iOS / Android) gets more powerful, we can not totally relay on that.
I Hope I explain it properly :)

Can I use javascript to record voice on a web app?

It seems I can only use Flash or Java to record voice on a web app. Is there a way of doing it via JavaScript?
It can be done but the solution won't work across all platforms at the moment.
<input type="file" accept="audio/*;capture=microphone">
See HTML5 Media Capture
Currently Supported By:
Android 3.0 browser, Chrome for Android (0.16), Firefox Mobile 10.0, iOS6 Safari and Chrome (partial support)
Links:
http://www.html5rocks.com/en/tutorials/getusermedia/intro/
Audio capturing with HTML5
Javascript cannot access your hardware directly. What you need, is a client side technology that can. Flash, for one.
Javascript can communicate quite easily with flash, so you can hide your flash recorder and construct your recorder ui with html/js/css.
Here's one example: https://github.com/jwagener/recorder.js/blob/master/examples/example-1.html
Here's another one:
http://blogupstairs.com/flashwavrecorder-javascript-flash-audio-recorder/
I realize this is not EXACTLY what you need, but you didn't tell why you want a JS solution. This doesn't fix the flash dependency problem but it solves the UI problem since you can construct the UI without flash.
Another wellknow solution is WAMI, I know it's not pure javascript but maybe it can help.
"As of this writing, most browsers still do not support WebRTC's getUserMedia(), which promises to give web developers microphone access via Javascript. This project achieves the next best thing for browsers that support Flash. Using the WAMI recorder, you can collect audio on your server without installing any proprietary media server software."
https://code.google.com/p/wami-recorder/
Another example using node.js
This example application is written in JavaScript and uses Node and Express for the web server and framework. You will need all three installed on your web server in order for this to work, as well as the Node.js WebAPI Library.
nodejs voice recording example
Yes there is a pure HTML/JavaScript way but it only works in Firefox and Chrome:
http://audior.ec/blog/recording-mp3-using-only-html5-and-javascript-recordmp3-js/
Direct demo: http://audior.ec/recordmp3js/

Questions regarding AppJS / Tidesdk

So not sure if this would be the correct place to ask these but I know I could perhaps get some answers.
I am getting into Meteor and now would like to make some desktop apps. I was going to go the route of just making a native Mac app. But then I found the app wunderlist and its open source making use of the tidesdk.
Anyways I was hoping to get some feedback just in general about these frameworks (pros/cons etc). I don't really have a conceptual understanding of what they do. (or what the main difference between the two is).
I notice you can do routing in them. How is this working exactly? Because there is no URLs or client/server side.
Another thing I was wondering is if it would be possible to use MeteorJS on the desktop in a similar way?
Thanks.
Working with TideSDK is quite easy. We are working to make the experience great for developers. You are essentially just creating an HTML5 app in a special Resources folder. In most cases you can drop an HTML5 app directly into the Resources folder, point to the index.html using TideSDK's configuration and have it running in minutes. TideSDK can be used to run clients, servers, processes, and workers. I tend to work with frameworks such as backbone.js where routing is baked into a single page app.
At the core of TideSDK is WebKit, the core technology that powers the Safari and Chrome web browsers. We use three different ports of WebKit in TideSDK, one to reach each platform (Windows, Mac, Linux). On OSX, we can also use the native WebKit. The APIs of TideSDK provide native UI capabilities (that we are enhancing over time). These include native windows, system trays, menus, and dialogs. You can also interact with the clipboard. We have networking and database capabilities, system notifications, and more. We patch Webkit to allow the interpretation of python, php or ruby in the DOM in script tags and are able to bridge objects between languages. Our API's really allow your to reach the resources of your system including interacting with its filesystem.
It would be fun to run meteor in TideSDK. It is currently possible to run node.js within TideSDK using an appropriate startup process so I cannot see an issue running meteor so that it can run client and server within an app.
If you need your apps to reach Apple's AppStore, TideSDK is the only framework that I am aware of that has this potential. Competitive frameworks use ports of WebKit that are not native to the Mac such as the Chrome port (appjs) or the QT port (Sencha Ion). Apple's scan of an app based on these ports will reveal the use of "private APIs". Therefore, you would could not enter the AppStore marketplace with an app based on these. TideSDK is different and can use the native WebKit implementation on OSX. More about this capability will be revealed in the upcoming TideSDK-1.4.0 release. Our upgraded WebKit will also bring the HTML5 capabilities right up to date with the trunk of WebKit. Many of our users are waiting for this important update.
With WebKit eliminated as a barrier to the AppStore, the last issue facing a developer is Apple's sandboxing and entitlement to the resources of the system. We are looking at possible solutions to aid developers with sandboxing requirements. Some apps will be suitable for sandboxing and others will not. That said, if your goal is AppStore compliance, you will need to work with restrictions Apple has in place. I hope this helps.

Is there access to the iPhone accelerometer using Javascript?

I'm starting to try and do some web based game programming for my iPhone, and other web enabled phones that my friends have, and was having a hard time finding information on accessing the accelerometer using Javascript in the browser.
With the latest release, I know I've got access to location information now but I was hoping that I could make use of the accelerometer for some of the games I plan on making.
Alternately, is this also possible with the Android phones?
In the latest iOS update (4.2) the accelorometer is now accessible from Javascript.
See: http://www.mobilexweb.com/blog/safari-ios-accelerometer-websockets-html5
iOS 4.2 provides Accelerometer & Gyroscope support through the DeviceOrientation API.
DeviceMotionEvent class
reference
DeviceOrientationEvent class
reference
Here a working javascript snippet.
If your are using iOS 4.2 or more, then you can do it: http://www.albertosarullo.com/blog/javascript-accelerometer-demo-source
jharlap is correct, however I'd be curious to know if this would work on the Palm Pre. Native development on the Pre is done using html and JavaScript, however there are special JavaScript APIs to access the phone's features that I believe only work for locally stored apps. I wonder if these are available through the browser. I doubt it, but it would be interesting.
Checkout PhoneGap project. It provides API to access the accelerometer and the GPS location from javascript.
"Regular" javascript cannot access the accelerometer info, it can access the geolocation using the W3C geolocation API supported by iPhone OS 3.0.
Yet, a project (e.g. PhoneGap) can be used to build a bridge between javascript and Objective-C capabilities to expose that functionality. This works if you want to deploy the app as a standalone application, that simply has one WebKit which loads the html content from the server.
I haven't played with their framework, but they provide templates for the iPhone and Android projects and you can work on developing your javascript game which would work almost-out-of-the-box on iPhone and Android. I cannot comment on the performance and the user experience though.

Categories