Hi there,
i’m writing a simple app to test some bluetooth calls.
I only added the support for Android.
The first tests was done with ‘ionic serve’ but the BT calls must done on a device.
So, i had two environments:
IonicView
'ionic run’
On both, running on a Samsung Tab2 10.1, the application was installed but I had the first blank page that means that something went wrong, but what?
Is there a way to see the console.log/error messages on IonicView?
The same for ‘ionic run’ ?
I’m wondering why, installing the app on the device, I had not received the Warning message for the use of the bluetooth.
Should be the cause of the problems??
1 778862 error ReferenceError: bluetoothSerial is not defined
at new <anonymous> (http://192.168.0.105:8100/js/controllers.js:50:9)
at invoke (http://192.168.0.105:8100/lib/ionic/js/ionic.bundle.js:13012:17)
...
The code is inside the defition of the controller ( bluetoothSerial.isEnabled(…) ).
My guess is that the bluetoothSerial is global but maybe is not visible (in the context) of the controller …
Do I need to pass it inside the $scope?
Where I can defined it?
I found that sometimes I see the debug messages of app.js (angualr.module(‘starter’, …)) before the ones in the controller function.
When i see the messages from controller before the app messages, sometimes i see the ‘not visible’ message for controller and ‘works’ for app messages .
I do not know if this comment is too late. The problem is bluetoothSerial global instance does not exists until after $ionicPlatform.ready is executed. I solved using $ionicPlatform.ready like this:
$ionicPlatform.ready(function() {
bluetoothSerial.isEnabled(function () {
console.log('bt is on!');
}, function () {
console.log('app bt not visible?!?!');
});
});