Apache Cordova and bluetooth - apache

Does Apache Cordova have the abilty to use the mobile device's bluetooth. I'm currently making an app on Android and it uses bluetooth but I would also like to make the same app on Apache Cordova and I can't find any type of documentation regarding using Apache Cordova and bluetooth.

Apache Cordova can make all platform APIs from iOS or Android available within a so called WebView. A WebView is basically rendering HTML, CSS and executing JavaScript. Platform APIs can be made available through plugins in Apache Cordova and inside the WebView can be used via JavaScript. You can either write your own plugin or use an existing one.
Android allows for Bluetooth classic and Bluetooth low energy. To my best knowledge iOS only has support for Bluetooth low energy. There are several plugins available for bluetooth support inside an Apache Cordova app, just use the plugin search on the Apache Cordova Website: https://cordova.apache.org/plugins/
Ranked by github stars you might use the following plugin for bluetooth le:
https://github.com/randdusing/cordova-plugin-bluetoothle
Or the following for bluetooth classic:
https://github.com/don/BluetoothSerial

#AdamV,
You'll have to use a plugin. Most anything you want to do on Phonegap requires a plugin.
My list (duplicate of Phonegap offical, list on page)
http://codesnippets.altervista.org/documentation/phonegap/plugins/list_of_plugins.html
The Cordova version:
http://plugins.cordova.io/#/search?search=bluetooth

Related

How to add browser platform to MFP cordova app?

I'm looking for a way to add browser platform to the current mfp cordova app for testing purpose. When I tried to run mfp cordova platform add browser, I got the error
Error: Hook not implemented yet for browser
By the looks of the commands, you're using 7.1. This release does not support the Web platform for Cordova apps.
Note that Mobile Foundation 8.0 supports standard Cordova apps, including the Web platform.

Difference between React-native and Electron

I want to build a simple read-only app which should run on Android, iOS, Windows, OSX and Linux.
Does electron support mobile platform?
I couldn't figure out which one should I go for.
Electron include chrome engine to render web pages as Native apps with support for different plugins to add desktop apps features.
Electrino doesn't include any render engine it uses the Safari engine on the Mac so the installation file is smaller than Electron.
There's no support for Windows yet.
React Native is using a cross-platform render to Android and iOS.
Example: <Text> on Android will be TextView and on iOS will be UITextField
React Native Web made React Native work on web
Example: <Text> on web will be <p> or <label> not sure
and after that, it can work on the desktop by electron
You can build universal apps by using this template by React Native code.
Also if you want a specific target you can add component.web.js or .electron.js
or .android.js or .ios.js so it will render to this target only
https://github.com/react-everywhere/re-start/tree/react-16
Take a look at PWAs. These can be installed on almost all the major mobile and desktop platforms plus it is a web app.
https://developers.google.com/web/progressive-web-apps
Electron does not support mobile platforms, but it will be difficult to use one framework for mobile apps and computer apps.
I would recomment to use phonegap for mobile and electron for the computer application

How do you utilize a third-party iOS SDK with your Appcelerator Titanium app?

We have a well established iOS (iPad only) app written on top of Appcelerator's Titanium platform. We're looking to integrate a third-party piece of hardware with our app that interfaces with the headphone jack on the iPad. The third-party company provides an official iOS SDK to be used in XCode projects.
How can we get the provided SDK to work in our Titanium app?
You'll have to create a module. Check the guide here.
You can also search the internet. There might be existing modules already for your third-party SDK.

Cordova Plugin to be used in Worklight, for geofencing in Background even if the app is suspended/terminated and also when the phone restarts

I have been investigating in this feature for a long time. All I can find is a pure iOS native code that checks for the key "UIApplicationLaunchOptionsLocationKey" from the LaunchOptions, if it is found it calls the LocationManager to start it and keep on listening to the location updates.
You can find this code in this github:
https://github.com/voyage11/GettingLocationWhenSuspended
I need the same concept, but with a way to integrate it in Worklight, through cordova plugin or something. As I'm already creating the geofencing triggers using the hybrid Worklight APIs, I need to keep the geofencing alive even when the app is suspended/terminated and also if the phone is restarted.
Please I need you support urgently. Thanks
Worklight provides the ability to create Cordova plug-ins.
You could implementing your own native code then, mimicking that from the Xcode project you've found on GitHub.
Read more here: Adding native functionality to hybrid applications

Cordova globalization plugin not working on intel xdk emulator

i'm trying to get the preferred language set on the device as following:
navigator.globalization.getPreferredLanguage(
function (language) {
alert('language: ' + language.value + '\n');
},
function () {
alert('nope');
}
);
And when I click on emulator i'm getting this pop-up:
I installed the cordova plug-in to use globalization:
cordova plugin add org.apache.cordova.globalization
And I also added this line on the config.xml:
<plugin name="Globalization" value="org.apache.cordova.Globalization" />
I tested on the device and it's working.
Btw, I'm using cordova 3.5 version but when i launch the intel xdk emulator it shows 2.9 version. Maybe that's causing this problem? I'm also using Storage plugin for sql queries and it's working fine!
Cordova plugins generally consist of two parts: 1) JavaScript API and 2) underlying native code that is specific to the target platform (e.g., Java code for Android, Objective C code for iOS, etc.) The Intel XDK emulator is a simulator that simulates that native part, but only in a very generic way and only for a select number of Cordova APIs. For any APIs that it does not have an underlying "native simulation" it provides this message so you can at least exercise code. It doesn't actually simulate the underlying functionality, but it does allow you to trace through those parts of your code.
Ultimately, you need to run it on a real device with a real build, as you discovered.
Also, the APIs that the XDK emulator knows about, at this time, are the 2.9.0 APIs. It is being modified to support 3.x APIs in a future release. BTW, the emulator in the XDK is a customized implementation of the Ripple emulator.