Bluetooth on Ionic


Hi, i am a beginner in the world of ionic (but i already like it). i trying to make an application that comunicate with bluetooth to a raspberry pi 3. i use the documentation of bluetooth but it doesn’t work. Anyone can make me an example of a page that use bluetooth for send data and receive? thanks


What exactly where you looking at and what did you try?


ionic bluetooth doc

import { Component } from '@angular/core';
import { NavController, NavParams, AlertController} from 'ionic-angular';
import { BluetoothSerial } from '@ionic-native/bluetooth-serial';

  Generated class for the Realtime page.

  See for more info on
  Ionic pages and navigation.
  selector: 'page-realtime',
  templateUrl: 'realtime.html'
export class RealtimePage {

  messages : any[] = [];

  // Define the URL for our server. As we are only running it locally, we will
  // use localhost

  constructor(public navCtrl: NavController, public navParams: NavParams, public alertCtrl: AlertController, private bluetoothSerial: BluetoothSerial) {


  connect() {

		this.bluetoothSerial.isEnabled().then(res => {

			this.bluetoothSerial.isConnected().then(res => {
			}).catch(res => {

		}).catch(res => {



This is what i tried


Then what happened?
How far did it work?


i have a button on my home screen that push to this page. if i click on the build android app nothing happend and i can’t see the page. in the emulator on browser i see this error “Error in ./HomePage class HomePage - caused by: No provider for BluetoothSerial!”. i think because on emulator in browser i doesn’t have the physical bluetooth hardware


Show us the code for that button.[quote=“cash18, post:5, topic:89112”]
if i click on the build android app nothing happend and i can’t see the page.

When you click what and where?[quote=“cash18, post:5, topic:89112”]
in the emulator on browser i see this error “Error in ./HomePage class HomePage - caused by: No provider for BluetoothSerial!”.

This error is pretty specific - why is it trying to do something with BluetoothSerial in the HomePage? Post the code of HomePage please.

No, that would manifest itself differently.


Sounds like failure to declare provider in app module to me. Oh, and don’t abuse any.


i have this button in home

<button  (click)="pushRealtime()" ion-button color="primary" outline>Realtime test</button>

and this is the typescript of the page

import { Component, EventEmitter } from '@angular/core';
import {MapsPage} from '../maps/maps';
import {TravelsPage} from '../travels/travels';
import {RealtimePage} from '../realtime/realtime';
import { NavController} from 'ionic-angular';

  selector: 'page-home',
  templateUrl: 'home.html'

export class HomePage {

  constructor(public navCtrl: NavController) {






sorry for all code writes soo confusing, that i write it’s for testing and i’m at the beginning of programming on ionic


So, what i can do for repairing it? i don’t understand


Hi, for what purpose are you using your bluetooth app. If its small data that doesnt require data streaming I would advise using the bluetooth low energy (BLE) plugin.

The bluetooth serial uses bluetooth 3.0 on android and windows phones. Consider rewriting your app in BLE if possible.

Also the way BLE works is much different than bluetooth serial, you should read up on gatt services and characteristics.


I want to send some coordinates gps from raspberry to the smartphone. The
problem is that I have some coordinates, because I track the trip of a car
and maybe there are too much data to send


Well my past experience with using Bluetooth serial is quite bad, the connection is usually very unstable and with the newer BLE protocols there is no need for the old Bluetooth classic.

Concerning the error you have, I think @rapropos is right, have you registered the BluetoothSerial provider in you app.module.ts file.

Also when debugging Bluetooth devices, you need to do it on devices, no emulator or browser testing will work.


Ok then if i use the raspberry that have Bluetooth 4.0 and a newer smartphone it may work? Are there any example?


Well if you’re using theRaspberry Pi 3 it comes with BLE, unfortunately I use other embeded Bluetooth solutions so I dont know the way to set it up. The rasp pi community is quite huge so Im sure theres tons of examples :slight_smile:

Concerning the Ionic side, the ionic native BLE documentation is a good start. Just be sure to get familiar with the way BLE works.


Well, thanks, I will try. Probably I will return here for asking other informations.


import this in app.module.ts file 'import { BluetoothSerial } from ‘@ionic-native/bluetooth-serial’ and in provider section mentotion BluetoothSerial