Reputation: 410
I cannot get a project with the latest Ionic (4) working with Ionic Native BLE on either Android or iOS. When adding this plugin, the app starts but goes completely blank after the splash screen. When inspecting the DOM, app-root is empty.
What I did:
ionic start ble-test tabs
ionic cordova plugin add cordova-plugin-ble-central
and
npm install @ionic-native/ble
import { BLE } from '@ionic-native/ble';
@NgModule({
declarations: [...],
imports: [...],
bootstrap: [IonicApp],
entryComponents: [...],
providers: [
...,
BLE
]
})
export class AppModule {}
I noticed the point of failure is when BLE is added to the list of providers. Without that, the app starts up just fine. With BLE added to the list, the white screen comes and the app does not start fully.
As this issue is recreatable with very minimal code, I believe something is fundamentally wrong with the BLE plugin. I hope to be proven wrong, but after hours of searching I cannot get to the bottom of this.
Full disclosure: I have also tried Ionic Native BluetoothLE, which has the same issue (which makes me believe even more that something is fundamentally wrong). BluetoothSerial does not crash the app, but it does not offer the kind of functionality I am looking for.
Upvotes: 1
Views: 1828
Reputation: 410
TL;DR: I was using a cached version of an older BLE version.
Thanks to for Aashay karekar noticing that my include path was off. However, when I used the correct path, Ionic could not find the specified (but correct) path. This made me look into versioning and I deleted the BLE from my package.json manually and removed the node_modules folder. When I then installed BLE again, everything worked fine.
Upvotes: 1