Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

register*StateChangeHandler doesn't work on Android since [email protected] #279

Closed
1 of 3 tasks
iwan-uschka opened this issue Mar 4, 2018 · 8 comments
Closed
1 of 3 tasks
Labels
bug Something isn't working properly TODO Something needs doing

Comments

@iwan-uschka
Copy link

iwan-uschka commented Mar 4, 2018

I'm submitting a ... (check one with "x"):

  • bug report
  • feature request
  • documentation issue

Bug report

Current behavior:

  • build android project with [email protected] (Android target: android-26) => registerLocationStateChangeHandler() does not work, neither does registerBluetoothStateChangeHandler()

Expected behavior:

  • registerLocationStateChangeHandler() should work like within [email protected] build (Android target: android-25)

Steps to reproduce:

Environment information

  • Cordova CLI version
    • cordova -v=> 7.1.0
  • Cordova platform version
    • cordova platform ls => android 6.3.0
  • Plugins & versions installed in project (including this plugin)
    • cordova plugin ls
      cordova-android-support-gradle-release 1.2.0 "cordova-android-support-gradle-release"
      cordova-plugin-device 2.0.1 "Device"
      cordova-plugin-device-orientation 2.0.0 "Device Orientation"
      cordova-plugin-facebook4 1.7.4 "Facebook Connect"
      cordova-plugin-inappbrowser 2.0.2 "InAppBrowser"
      cordova-plugin-network-information 2.0.1 "Network Information"
      cordova-plugin-splashscreen 5.0.2 "Splashscreen"
      cordova-plugin-statusbar 2.4.1 "StatusBar"
      cordova-plugin-whitelist 1.3.3 "Whitelist"
      cordova.plugins.diagnostic 3.9.2 "Diagnostic"
      ionic-plugin-keyboard 2.2.1 "Keyboard"
  • Dev machine OS and version, e.g.
    ProductName: Mac OS X
    ProductVersion: 10.11.6
    BuildVersion: 15G19009

Runtime issue

  • Device details
    • LG Nexus 5X
  • OS details
    • Android 8.1

Android build issue:

  • Node JS version
    • node -v => v9.4.0
  • Gradle version
    • ls platforms/android/.gradle => 2.14 3.3
  • Target Android SDK version
    • android:targetSdkVersion in AndroidManifest.xml => 25
@dpa99c dpa99c added the investigate Issue requires investigation label Mar 4, 2018
@iwan-uschka
Copy link
Author

Just checked cordova-diagnostic-plugin@4 and the error still occures.

@dpa99c
Copy link
Owner

dpa99c commented Mar 4, 2018

Seems that the Android APIs have changed since API 26, as stated here:

there's no way on Android API 26 to listen to implicit broadcasts like <action android:name="android.location.PROVIDERS_CHANGED" /> if the app is killed or isn't currently running in background.

Since the plugin currently uses implicit broadcast filters I'll need to rewrite it to register broadcast receivers at runtime. Thanks Google...

@dpa99c dpa99c added bug Something isn't working properly TODO Something needs doing and removed investigate Issue requires investigation labels Mar 4, 2018
@iwan-uschka
Copy link
Author

Thanks for taking care of this one. And yeah, thanks google...

@dpa99c
Copy link
Owner

dpa99c commented Mar 5, 2018

Only now did I spot the Broadcast Limitations section in the Android 8.0 documentation.

Anyway, I'm working on this now so hope to push out a patch version some time today.

@dpa99c dpa99c closed this as completed in c141856 Mar 5, 2018
@dpa99c
Copy link
Owner

dpa99c commented Mar 5, 2018

Fix published in v4.0.1

@iwan-uschka
Copy link
Author

Ahh, i wasn't able to test it yet but i want to say thank you!

@EdwinRozario
Copy link

@dpa99c I have noticed an odd behaviour registerLocationStateChangeHandler() for Android across all devices in v5.0.0. We are using Ionic4 with [email protected].

permission_modal

  1. The above page requires location permission and the modal is presented to the user. The app is listening to registerLocationStateChangeHandler() so that a map can be rendered in this page.

nearme_page

  1. After allowing permission registerLocationStateChangeHandler() dosent seem to have fired so we still have the open setting button.

settings

  1. Opening Setting and allowing location.

relaunch

  1. Relaunching the application after the settings change works fine.

I tried to debug this. It seems registerLocationStateChangeHandler() dosent receive any state change when allowing permission from the modal popup but it receives state change when allowing it from settings.

Sorry if this is the wrong place to mention this issue. It looked like it had to do with registerLocationStateChangeHandler().

@ramikhafagi96
Copy link

@EdwinRozario I do have the same problem now with android devices, did you find a solution for it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working properly TODO Something needs doing
Projects
None yet
Development

No branches or pull requests

4 participants