First time poster here , so I'm sorry if this question is asked incorrect or if there are any issues.
I'm working on a phonegap app for which I need to be able to set up a bluetooth connection between a tablet (android in this case) and a Win CE PC.
Currently i'm trying to get the bluetooth part to work on the tablet and i'm using the plug in you can find at https://github.com/tanelih/phonegap-bluetooth-plugin
And for the momemt I'm just trying to enable and disable the Bluetooth on the device.
In my bluetoothpage.js file i'm using the following method
window.bluetooth.prototype.enable(bluetoothTestSucces(),bluetoothTestFail());
The bluetoothTestSucces and bluetoothTestFail functions just show an alert, nothing else.
And if i understand the working of phonegap plugins correctly this uses the following code in my bluetooth.js file
Bluetooth.prototype.enable = function(onSuccess, onError)
{
exec(onSuccess, onError, "Bluetooth", "enable", []);
}
which calls
private void enable(JSONArray args, CallbackContext callbackCtx)
{
try
{
_bluetooth.enable();
callbackCtx.success();
}
catch(Exception e)
{
this.error(callbackCtx, e.getMessage(), BluetoothError.ERR_UNKNOWN);
}
}
in my BluetoothPlugin.java file.
And if the java file returns Succes bluetoothTestSucces() is used and if the java file returns an error bluetoothTestFail() is used.
But for some reason it runs both and does not turn on bluetooth on my device.
I'm almost certain I've forgotten a link to a file or have linked it wrong somewhere.
But I've followed the instructions that were included in the plugin.
I've included the Bluetooth permission in my AndoridManifest file which is located in the root directory of my app
I've included the plugin in my config.xml file which is located in res/xml
I've required the plugin after the deviceready event as follows
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady()
{
window.bluetooth = cordova.require("cordova/plugin/bluetooth");
}
Could anyone tell me how to fix this or what i've done wrong?
thanks
Martijn
PS: I'm sorry for any language errors, English isn't my native language.
edit: forgot to include some code