Backgroundmode plugin pushes app to background when permission modals open

#1

hi, I am using ionic 3 and testing on Android 6.0 - Samsung Galaxy S7.

I added the native plugin ("@ionic-native/background-mode": “^4.17.0”) to my app and it is working as expected when app goes into the background and comes out again.
But, I see the following behaviour as well- couple of pages on my app request permissions from the user when they run the app the first time after installation - to use location when user tries to scan for bluetooth devices (plugin ionic-native/bluetooth-serial": “^4.5.3”) and read/write permission when they write a file to the phone (ionic-native/file": “^4.7.0”).

After adding backgroundmode plugin the app goes into background when the permission modals open for location and file writing.

I am listening to these events-

this.backgroundMode.on(“activate”)
this.backgroundMode.on(“deactivate”)
this.backgroundMode.on(‘failure’)

Thank you so much for reading. If you need more information about my setup please ask. Any help is appreciated. If this is a bug, how do I report this? Cheers!

#2

Found my error!
I had left in this command in my background code logic!
this.backgroundMode.moveToBackground();

As backgroundmode is activated whenever there is a permission popup, moveToBackground() forced the app into the background.