Can Anyone provide me a working code in ionic of transmitting and scanning ble beacon on the same mobile device

I have tried many thing and I came accross 2 liberaries:-

  1. For Eddystone :-
  2. For Ibeacon :-

But as I am new to the ionic development, I am not able to write a proper working code. Please do help! Thanks in Advance.

People are not going to write the code for you. The community is here to help, but please share what you’ve tried first instead of asking for code.

import {ChangeDetectorRef, Component} from '@angular/core';
import { Platform} from 'ionic-angular';
import {IBeacon} from "@ionic-native/ibeacon";
import {isBoolean} from "ionic-angular/util/util";
  selector: 'page-home',
  templateUrl: 'home.html'
export class HomePage {
  homePage: string =null;
  outputdata: any;
  outputerror: any;
  inputdata: any;
  inputerror: any;
  beaconData: any;
  advertinputdata: any;
  advertavailinputerror: any;
  buke: any;
  auther: any;

  constructor(public change: ChangeDetectorRef,
              public platform: Platform,
              private ibeacon: IBeacon,) {
    this.homePage =  "1000";
 watch() {
      data => this.auther = data.authorizationStatus,
      error => console.error(error)
       ()=> this.buke = isBoolean(this.ibeacon.isBluetoothEnabled()),
       error => console.error(error)
     this.ibeacon.startAdvertising(this.ibeacon.BeaconRegion('deskBeacon', '7813eab4-9ee5-447b-b3ee-6179c9b9877a', 10, 10, true), -59).then(
       () => this.inputdata = "yay!" + console.log("yay! task done"),
       error => console.error(error)
       () => this.advertinputdata = isBoolean(this.ibeacon.isAdvertising())  ,
       error => console.error(error)


    // Request permission to use location on iOS
// create a new delegate and register it with the native layer
    let delegate = this.ibeacon.Delegate();

// Subscribe to some of the delegate's event handlers
        data => this.outputdata = data,
        error => console.error()
        data => console.log('didStartMonitoringForRegion: ', data),
        error => console.error()
        data => {
          console.log('didEnterRegion: ', data);

    let beaconRegion = this.ibeacon.BeaconRegion('deskBeacon','7813eab4-9ee5-447b-b3ee-6179c9b9877a');

        () => console.log('Native layer received the request to monitoring'),
        error => console.error('Native layer failed to begin monitoring: ', error)



the output that i am getting is :
.isAdvertising() = false
.isBluetoothEnabled() =false
.getAuthorizationStatus() = authorised
.startAdvertising()= i am getting yay but its not advertising

plus when i was trying evothing’s eddystone after adding the plugin the advertising code is not working as the downloaded plugin’s code itself doesn’t has the startadvertising function but online where i see the source code it is present

That function is annotated @hidden, which I take to mean that it should not be referenced in app code.

Since isBluetoothEnabled returns a Promise, this expression will always be false. Same story for isAdvertising.

whats the solution i could try to solve this and get the device advertising?