katzer / cordova-plugin-badge

Access and modify badge numbers
Apache License 2.0
409 stars 252 forks source link

Error on Android: this.createCallbackFn is not a function #116

Open sebastianhelbig opened 6 years ago

sebastianhelbig commented 6 years ago

Anyone else experienced this? Testing on emulator. (Nexus_5X_API27, Android 8.1.0)

Plugin version: 5.3.0 Platform: Android OS version: OS X Cordova version (cordova -v): 8.0.0 Cordova platform version (cordova platform ls): android 7.0.0

katzer commented 6 years ago

@sebastianhelbig Please provide a code snippets that reproduces the error message.

sebastianhelbig commented 6 years ago

Same error with cordova-android-6.4.0

Code is

    if (window.cordova.plugins &&
        window.cordova.plugins.notification &&
        window.cordova.plugins.notification.badge
    ) {
      window.cordova.plugins.notification.badge.requestPermission();
    }

I solved it by using only this instead:

    if (window.cordova.plugins &&
        window.cordova.plugins.notification &&
        window.cordova.plugins.notification.local
    ) {
      window.cordova.plugins.notification.local.requestPermission();
    }