question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to find any devices. IOS

See original GitHub issue

Hello! Tried to use the plugin, figured how to subscribe to events, that have to be spawned while scanning via BleManagerDiscoverPeripheral. Everything went well, though, no events were dispatched. Tried to use your example project from repo, same thing. No exceptions, no logs, just no devices discovered, though through IOS settings I can see few available to connect. Have seen issue https://github.com/innoveit/react-native-ble-manager/issues/215, however it doesn’t look handy in my case.

Is there any suggestion where to explore further? Thanks in advance!

“react-native”: “0.48.3”, “react-native-ble-manager”: “^6.1.1”, tested on Iphone 7 IOS 11 & Iphone 5s IOS 10.3.3

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Sprit3Dancommented, Sep 21, 2017

Truth is that I found this issue earlier and developed the bluetooth-service the right way as I understand. Here’s the code.

import { Observable } from 'rxjs/Rx';
import * as BleManager from 'react-native-ble-manager'
import { NativeEventEmitter, NativeModules } from 'react-native'

import { injectable } from '../';

abstract class BluetoothServiceApi {
	abstract searchDevice(services?: Array<any>, seconds?: number): Observable<any>
}

@injectable()
export class BluetoothService {
	private bluetoothReady: Promise<BluetoothServiceApi>;
	private bleManagerEmitter: NativeEventEmitter;

	private api = {
		searchDevice: this.searchDevice.bind(this),
	};

	constructor() {
		this.bleManagerEmitter = new NativeEventEmitter(NativeModules.BleManager);

		this.bluetoothReady = new Promise((res, rej) => {
		BleManager.start({ showAlerts: true, forceLegacy: true })
			.then(() => {
				res(this.api);
				console.info('bt started');
			});
		});
	}

	public get ready(): Promise<BluetoothServiceApi> {
		return this.bluetoothReady;
	}

	private searchDevice(services: Array<any> = [], seconds: number = 5): Observable<any> {
		let scanEmitter;
		
		BleManager.scan(services, seconds)
			.then(() => console.info('scan started'));
			
		this.bleManagerEmitter.addListener('BleManagerDiscoverPeripheral', (data) => {
			console.log(data);
		});
			
		return new Observable<any>(emitter => scanEmitter = emitter);
		// return Observable.fromEvent(this.bleManagerEmitter, 'BleManagerDiscoverPeripheral');
	}
}

and the usage of it.

@inject(BluetoothService) btService: BluetoothService;
  
  componentWillMount() {
    this.btService.ready.then(api =>
      api.searchDevice().subscribe(data => console.log(data))
    );
  }

Though, it didn’t help much

0reactions
Ilario17commented, Feb 28, 2019

@Sprit3Dan how did you solve this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

iPhone Can't Find Bluetooth Devices? Here's The Fix!
iPhone Can't Find Bluetooth Devices? Here's The Fix! · Turn Bluetooth Off And Back On · Restart Your iPhone · Activate Pairing Mode...
Read more >
If you can't connect a Bluetooth accessory to your iPhone ...
If there's an app that you use with the Bluetooth accessory, go to Settings > Privacy > Bluetooth on your iOS or iPadOS...
Read more >
iPhone Bluetooth Can't Find Devices
First double-check that Bluetooth is turned on in your iPhone. Tap "Settings" and select "Bluetooth." Confirm the Bluetooth switch reads "On." If Bluetooth...
Read more >
How To Fix When Your iPhone Can't Find Bluetooth Devices
First, check your Bluetooth connection settings · Unpair the Bluetooth device and reconnect · Reset network settings on your iPhone · Update your ......
Read more >
6 ways to fix an iPhone that won't connect to Bluetooth
Turn on Bluetooth · Make sure your device is connected to Bluetooth · Delete other devices from Bluetooth · Update your software to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found