0

My Bluetooth app is running well when I am building the app with

ionic cordova build android command. 

BUT when I am building my app with -- prod flag i.e.

ionic cordova build android --prod

my app is not getting access to the BLUETOOTH SERIAL cordova plugin and running as if it is on a desktop browser without cordova support.

I am using …

  • ionic-angular “3.7.1”
  • ionic-native/core "4.3.0"
  • ionic-native/bluetooth serial “4.3.2”
Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
shafiul2344
  • 59
  • 2
  • 6
  • By the way there is no space between the 2 hyphens.. Also are you calling the plugin within `this.platform.ready()`? Are you getting the cordova platform not available warning in the console? – Suraj Rao Nov 27 '17 at 05:25
  • Actually I haven't given the space between hypeen. It's writing mistake only here. And I have not called the plugin within this.platform.ready(). I will try that after sometimes. But onething is that with normal bulid i.e "ionic cordova build android", no problem is there. My app is running as expected. On the other hand with --prod flag build, no bluetooth plugin is working. The app is behaving as we get the app in Web Browser in desktop with ionic serve without cordova support – shafiul2344 Nov 27 '17 at 07:16
  • try with platform.ready.. also the command for prod build is `ionic cordova build android --prod --release`. The release flag tells cordova to build a release version – Suraj Rao Nov 27 '17 at 07:18
  • My problem is solved. – shafiul2344 Nov 27 '17 at 13:08

2 Answers2

2

Maybe you're rootpage is called before your platform.ready() is called, so try to initialize value of rootpage in platform.ready().

Husain
  • 579
  • 2
  • 15
0

My problem solved . The solution came after I used my Bluetooth Plugin in ..... platform.ready().then()

shafiul2344
  • 59
  • 2
  • 6