Data management / calculations when using PhoneGap / Cordova - javascript

I am developing an application on iOS and Android. The application uses Bluetooth (standard Bluetooth not BLE) to send/receive information. It may not be of relevance but for reference my current test device is a Nexus 5.
The application is built with Cordova (or PhoneGap) so the UI is HTML5/JavaScript/css and the Bluetooth plugin is written in native (Java for Android, Obj-C for iOS). Futhermore the UI was created with the help of Bootstrap, jQuery, Backbone.js and Underscore.js.
My question is regarding the management of the Bluetooth data coming in. I haven't developed it yet, but I wish to have a Bluetooth listener service running, that will be able to perform calculations on the Bluetooth data being received. Before start, I kind of wanted to get an idea of my options and an idea of what the best method of attack would be. I could write a plugin to manage the data received, so that the data would be dealt with by native code (which to my knowledge would run smoother).
However, since my application is multi-platform (currently only iOS and Android but possibly more platform in the future) it makes more sense to me trying to tackle the data calculations without using plugins/native. Would it be feasible to attempt this in JavaScript? I've heard it can be quite laggy and cause timing issues within Cordova/PhoneGap applications when you increase the complexity.
Does anyone have any experience with this and may be able to shed some light? It would be most appreciated.
Thanks.

I wrote a plugin that interfaces with a BT printer and found that the best performance was achieved with handling all calls and logic in a background thread. If not, the UI performance suffered greatly.
It is was not desirable to have to write everything twice in each native language, but the performance gain was well worth the effort.

Related

Protecting Apps with Apache Cordova MS VS Extension on App Stores

Just have a question about apps that are uploaded on the Windows Store, Andriod Store, and Apple Store. I have never built an App before for any of the three stores, but the Multi Hybrid Extension for Visual Studio seems to be a great start to cover all three Platforms.
How do I protect my code for apps that are uploaded to the three stores? The core development for the Apache Cordova extension is done in HTML5 and Javascript. On a regular HTML / Javascript website, the end user can simply right click and View Source of the page and see all the code I've written.
My question is, how is this protected for apps that are uploaded to the app store? Will someone be able to reverse engineer my application and get the code and simply re-sell it?
Thank you all for your time
You want to, develop once, deploy many. Then, you’ll want to use HTML5 to do it.
You can use Apache Cordova directly, but you’ll want to use a service like Telerik AppBuilder, Adobe Phonegap or Intel XDK.
Regarding your question, your best bet is to use a good JavaScript source code obfuscation service to protect your sources before publishing. There is no such thing as a 100% full proof solution when it comes to JavaScript obfuscation, but professional tools such as JScrambler can take you a long way. At least JScrambler I know that it supports Mobile and HTML5, which is good because they make sure the resulting code is compliant.
There are other tools, even free ones. But be careful though, there are tons of other tools that do obfuscation, encoding/packing or minfication that seem to provide protection, but are reversed in a few minutes. So, unless you really know how to tell the difference, I recommend that you rely on a professional service.

Audio manipulation using node.js

My team has been using the Web Audio API/Getusermedia in a product and we are going really well with our chrome and firefox users. But we still have a large base of users that we would love to reach, but due to technology barriers, we still can't (mostly, those are IE users), as their main browser does not support the technology, and they do not or can not change to a modern browser.
We are planning to get to those users, but we don't want to go to Flash, Flex, Silverlight or anything similar.
So, thinking about solutions, I thought that maybe I could pass by this difficulty if I moved the audio manipulation, from the browser to the server. NodeJS was the first answer when trying to figure out how to do it.
Would it be possible to be done using NodeJS? Are there any libraries available that would help us accomplish this? Are there any other technologies that would allow me to do this?
Thanks anyone that could help.
It could easily be done. Node is simply an IO engine designed for rapid response. If it needs to happen in real time then I imagine latency would be a usability-breaking issue due to networking restraints. If it doesn't, then I think it would be a great solution! :)
Either way here are a couple related resources
https://www.npmjs.org/package/webrtc.io <- latency optimization library intended for work with media streams
http://wac.ircam.fr/ an upcoming conference (Jan 2015) dedicated to the types of problems you are dealing with.
http://www.sitepoint.com/5-libraries-html5-audio-api/ A few web libraries for use with audio. #3 and #4 look like they are related to what you are trying to do
You can try using this (is in development):
Node Web Audio API
https://github.com/sebpiq/node-web-audio-api
Installation
npm install web-audio-api
Demo
node test/manual-testing/AudioContext-sound-output.js

Cross-platform Mobile App with HTML5

I was asked to provide a tablet application with HTML5/JS/CSS which does not have dependency on any platform. Requirements:
Cross-platform mobile/tablet application
Offline capability and Storage (it should work in lack of internet connectivity and be able to synch after get connected)
Real-time data (it should be able to show any small changes from sensor values)
I should be able to connect to a CAN interface and get sensor values and ECU data. Because I have not come up with any solution for this part, I am thinking about Bluetooth. However, HTML5 doesn't support Bluetooth.
I'd appreciate to give me some vision if HTML5/JS/CSS can deal with this requirements (especially with Bluetooth)
Another question is that is it possible not to use any frameworks such as PhoneGap, RHoMobile, .... and just develop cross-platform app with raw HTML5/CSS/JS and have all requirements?
Have you looked in to PhoneGap / Cordova yet?
You can easily create cross-platform mobile applications using HTML5, JS and CSS.
http://phonegap.com
The built-in API provides access to most of the device's native features and functions. You can manage offline storage using localStorage or SQLite databases, and can detect network connectivity statuses to determine if you are offline / online and what level of connection you have (Edge, 3G, 4G, WiFi). With a combination of those, you could manage your data synchronisation.
As for bluetooth, the PhoneGap API doesn't support it out of the box, but it is highly extensible so developers can create their own plugins for missing or required functionality.
The community is awesome and many of the plugins have been compiled into a central repository on GitHub: https://github.com/phonegap/phonegap-plugins
I know that there is a Bluetooth plugin for Android available on that repository.
You can also write your own plugins quite easily to add any extra features that you need:
http://www.adobe.com/devnet/html5/articles/extending-phonegap-with-native-plugins-for-android.html
http://www.adobe.com/devnet/html5/articles/extending-phonegap-with-native-plugins-for-ios.html
** EDIT **
You posted an amendment to the question afterI'd written this answer mentioning PhoneGap. The honest answer is no, without a framework that interacts with the native device functionality, raw HTML5, CSS and JS would not be able to deal with bluetooth etc.
No, you cannot. A pure web application is not able, and will likely never be able, to use bluetooth.
HTML5 Bluetooth and Audio
Having developed a Web App before, I can tell you that anything involving offline has to be simple, and using device hardware is out.
Check out the frameworks, you may be able to get something to work. But it may just be a better/more realistic bet to develop a Native Application from the get go.
After a lot of searching I came up with MoSync which is a cross-platform SDK and is intended for developing different mobile applications. I believe MoSync can be the best answer for this question since it is really a rich SDK (C, C++, HTML, JavaScript) and has great tools and community that try their best to help you.
For further information I encourage developers to check here or visit their websites.
Most of the future mobile apps will be developed using HTML5. HTML5 standards are getting adopted very rapidly and those standards are supporting phone features like GPS, Accelerometer, Camera, Storage etc.
I will recommend you to use PhoneGap if you want to use any device features.

Would Apple allow V8-powered Javascript apps on iOS?

There's been a lot of talk about Google being forced to go with UIWebView for Chrome for iOS, and Facebook ditching HTML5 entirely for their iOS apps because UIWebView was too slow. I'll soon be needing to port an HTML5 application that requires lots of intensive Javascript computations (too much code to rewrite natively given my time constraints) but none of the display functionality that a browser provides (i.e. it works fine headlessly on Node.js). I've never heard of anyone trying to embed Google's V8 into an iOS app, but given that MobiRuby does practically the same thing (linking in the mruby interpreter), would it be permissible to do something similar, linking in Google's V8 interpreter within the same process? As long as code isn't downloaded, and processes aren't forked, it doesn't seem to be against the rules, but has anyone ever tried this?
EDIT: I'm aware of PhoneGap/Cordova and similar technologies, but they all work with a full UIWebView, and due to Apple's paranoia, UIWebView cannot JIT-compile Javascript code (which, as I said, is essential for my application).
According to what is mentioned in this this thread on the v8-dev mailing list, it may now be possible. You may be interested in the state of the work on this issue.

Launching an application from a browser (platform and browser independent), best approach?

Please forgive a question that has been addressed in some form or fashion previously. I have numerous test applications that run on various platforms from Windows 95, Windows XP, SUSE, RedHat, and other forms of *NIX. Currently, the mechanism has a native application that queries a database for some information then launches the test application to perform the test. This said program is a "launcher application" which I am trying to convert to a "HTML/Javascript Launcher Application". In addition, this "launcher application" needs to known when the test application is completed, then collect the test result then store the results in a database.
I have read that launching an application (executable) from HTML is not permitted, but this is entirely true in the sense (if I understand correctly). From what I have read here on SO and other sites, I have the following possible solutions:
Registering a unique protocol to an test application (SO Link)
Using Java to launch the application
Adobe AIR or its opensource counter part, Titanium by Appcelerator
Using WSH, though this will only work on Windows platforms
What would be a good (or best ) approach to solution this problem? Ideally, I would like to just use HTML and Javascript, but this may not be possible? Thanks for any advice and any example/sample code would be greatly appreciated.
Mark
Hopefully many people will think, as I do, that this is a 'bad idea'™, simply because in order for it to work you must allow your browser to launch software, which would be a huge hole in security, allowing access for all sorts of nasties.
Given you are cross platform I'd suggest you stick with a dedicated laucher application, but code it in java. This is the most common solution used in the java applications world which regularly crosses os's.
You could give JNLP (java network launch protocol) a try... Really easy to distribute and deploy full fledged applications in a platform independent manner. More or less through the browser if you like...

Categories

Resources