Posts

Showing posts with the label HTML5

Getting an Access of Android Java Code to a PhoneGap JavaScript.

PhoneGap Provides a standard set of functions available in PhoneGap docs to access the internal Device Details like the list of the phone numbers, access to camera etc. Apart from this standard functions, if our requirements extends then these available functions, then we need to create our own custom logical functions which access the internal device hardware details like 'imei' number etc or to apply some custom logic or validate the data and then make it available to PhoneGap, then this article helps to do the same. Though PhoneGap provides the 'imei' number through the standard function 'device.uuid' but in Android 2.1, it is still an issue. For such cases we need to take the help of the Native Android Java Code and then make it accessible to PhoneGap, here is how we will be doing the same. Following example is of getting the device's 'imei' number through the Android's TelephonyManager class and then make it available to Pho...

Extending HTML5 Mobile Apps with C++ in MoSync

Invoke C++ Code from JavaScript The following example code is based on the HTML5/JS/C++ Hybrid Project Template . This template illustrates how to invoke custom C++ code from JavaScript. The UI has buttons for making the device vibrate and beep. To create a project based on this template, launch MoSync SDK, and create an app in the Eclipse-based IDE, using the HTML5/JS/C++ Hybrid Project template. Then you will get the source code discussed below. The template app uses the Wormhole C++ library (classes HybridMoblet and MessageStream) and the JavaScript libraries included in the file wormhole.js (all included with the application template). Sending String Messages It is good to know that two message formats are supported by Wormhole: JSON messages and String stream messages. The example we discuss here uses String streams. String streams are a performant way of sending messages from JavaScript to C++. This method is generally faster than JSON messages (on some platfor...