# Bluetooth Serial Listing Problem

**URL:** <https://forum.ionicframework.com/t/bluetooth-serial-listing-problem/20501>\
**Category:** cordova\
**Created:** [April 8, 2015, 7:14am UTC](https://forum.ionicframework.com/t/bluetooth-serial-listing-problem/20501 "2015-04-08T07:14:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gereksizcoder](https://avatars.discourse-cdn.com/v4/letter/g/8e8cbc/32.png) [@gereksizcoder](https://forum.ionicframework.com/u/gereksizcoder)\
**Post date:** [April 8, 2015, 7:14am UTC](https://forum.ionicframework.com/t/bluetooth-serial-listing-problem/20501/1 "2015-04-08T07:14:56Z")

</div>

I m using ionic latest version (1.3.19) and ngCordova. I want to use Bluetooth Serial. I write this in my app.js . Bluetooth Enable or Disable works great but .I cant learn Bluetooth list. Where is my wrong ?

```
// Ionic Starter App

   // angular.module is a global place for creating, registering and retrieving Angular modules
 // 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
   // the 2nd parameter is an array of 'requires'
   angular.module('starter', ['ionic','ngCordova'])

  .run(function($ionicPlatform) {
   $ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if(window.cordova && window.cordova.plugins.Keyboard) {
  cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if(window.StatusBar) {
  StatusBar.styleDefault();
}
 });
 }).controller("MainCtrl",function($scope,$ionicPlatform,$cordovaBluetoothSerial){
    $scope.bluetoothEnable="";

        $cordovaBluetoothSerial.isEnabled().then(function(){
            $scope.bluetoothEnable="Bluetooth Enable";

        },
        function() {
            $scope.bluetoothEnable="Bluetooth Disable";

        });
       $scope.liste=function()
       {
           $cordovaBluetoothSerial.list().then(function(result){
           $scope.btlist=result;

       },
           function(error){
            console.log(error) ;
           });

       }
        $scope.undiscoverdliste=function()
        {
            $cordovaBluetoothSerial.discoverUnpaired(event).then(function(result){
                $scope.btlist=result;
            },function(error){
                console.log("Err");
                $scope.btlist=error;
            });

        }

});
```

---

<div class="post-metadata">

**Author:** ![MWright24](https://avatars.discourse-cdn.com/v4/letter/m/e47c2d/32.png) [@MWright24](https://forum.ionicframework.com/u/MWright24)\
**Post date:** [April 8, 2015, 8:24am UTC](https://forum.ionicframework.com/t/bluetooth-serial-listing-problem/20501/2 "2015-04-08T08:24:20Z")

</div>

I’m also using a this plugin and I think it’s due to the structure of the function

```
// Ionic Starter App

// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
angular.module('starter', ['ionic','ngCordova'])

.run(function($ionicPlatform) {
    $ionicPlatform.ready(function() {
    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
    // for form inputs)
    if(window.cordova && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
     }
     if(window.StatusBar) {
      StatusBar.styleDefault();
     }
     });
     }).controller("MainCtrl",function($scope,$ionicPlatform,$cordovaBluetoothSerial){
       
 $scope.bluetoothEnable="";

bluetoothSerial.isEnabled(
        function() {
          $scope.bluetoothEnable="Bluetooth Enable";
        },
        function() {
          $scope.bluetoothEnable="Bluetooth Disable";
        }
    );

   $scope.liste=function()
   {
       bluetoothSerial.list(
        function(paireddevices) {
            angular.forEach(paireddevices, function(paireddev){
               $scope.btlist.push(paireddev);
            });
        },
        function(){
            console.log('error') ;
    });

   };

    $scope.undiscoverdliste=function()
    {
    bluetoothSerial.discoverUnpaired(
        function(undevices) {
            angular.forEach(undevices, function(device){
                $scope.btlist.push(device);
            });
        },
        function(){
            console.log("Err");
    });

    };

```

Hope that helps / works 😉

---

<div class="post-metadata">

**Author:** ![gereksizcoder](https://avatars.discourse-cdn.com/v4/letter/g/8e8cbc/32.png) [@gereksizcoder](https://forum.ionicframework.com/u/gereksizcoder)\
**Post date:** [April 9, 2015, 12:48pm UTC](https://forum.ionicframework.com/t/bluetooth-serial-listing-problem/20501/3 "2015-04-09T12:48:51Z")

</div>

Hey Matthew ,Thanks for help but its not working I tried samsung S4 mini . only "Bluetooth Enable " works. 🙂

---

<div class="post-metadata">

**Author:** ![multilexus](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@multilexus](https://forum.ionicframework.com/u/multilexus)\
**Post date:** [August 11, 2015, 2:36pm UTC](https://forum.ionicframework.com/t/bluetooth-serial-listing-problem/20501/4 "2015-08-11T14:36:09Z")

</div>

Guys, how do you get $cordovaBluetoothSerial to work? The moment I put “$cordovaBluetoothSerial” in my controller, everything stops working. I’ve added ngcordova.js before cordova.js in my index.html and added ngcordova.js under lib folder. I’ve added BluetoothSerial plugin using “ionic plugin add com.megster.cordova.bluetoothserial” command. My code is identical to the one above. I’m out of ideas. Please help.

---

<div class="post-metadata">

**Author:** ![Cyn4ck](https://avatars.discourse-cdn.com/v4/letter/c/c5a1d2/32.png) [@Cyn4ck](https://forum.ionicframework.com/u/Cyn4ck)\
**Post date:** [January 13, 2016, 6:18pm UTC](https://forum.ionicframework.com/t/bluetooth-serial-listing-problem/20501/5 "2016-01-13T18:18:29Z")

</div>

Up for this topic ! 😄

---

<div class="post-metadata">

**Author:** ![Ravirapolu](https://avatars.discourse-cdn.com/v4/letter/r/22d042/32.png) [@Ravirapolu](https://forum.ionicframework.com/u/Ravirapolu)\
**Post date:** [October 9, 2017, 6:10am UTC](https://forum.ionicframework.com/t/bluetooth-serial-listing-problem/20501/6 "2017-10-09T06:10:58Z")

</div>

iam using this plugin. Iam able to connect to the bluetooth printer also. But when i write hello world data to the printer, iam unable to print. help me guys. After connecting to device iam directly writing data to printer is it correct or else i need to subscribe the device thereafter should i write data . Please share the example wih code.
