chemerisuk / cordova-plugin-firebase-messaging

Cordova plugin for Firebase Cloud Messaging

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[ANDROID] - getToken() - OK in DEBUG, FAIL in RELEASE - 'Invalid action'

cosmicdust471 opened this issue · comments

I've encountered a weird situation.

On Android, when I build a signed debug APK and call getToken(), I get it right away.

However that same APK, signed for release, fails.

Cordova: 10.0.0
Android: 9.1.0

Calling

cordova.plugins.firebase.messaging.getToken().then(function(token) {
    console.log("Device token", token);
}).catch(function(error){
    console.error(error.message);
});

Returns

Uncaught (in promise) Invalid action

Package.json dependencies and plugins

{
  "dependencies": {
    "cordova-plugin-buildinfo": "4.0.0",
    "cordova-plugin-customurlscheme": "5.0.2",
    "cordova-plugin-device": "^2.0.3",
    "cordova-plugin-inappbrowser": "^5.0.0",
    "cordova-plugin-keyboard": "^1.2.0",
    "cordova-plugin-safariviewcontroller": "^2.0.0",
    "cordova-plugin-splashscreen": "^6.0.0",
    "cordova-plugin-statusbar": "^2.4.3"
  },
  "cordova": {
    "plugins": {
      "cordova-plugin-statusbar": {},
      "cordova-plugin-keyboard": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-device": {},
      "cordova-plugin-inappbrowser": {},
      "cordova-plugin-safariviewcontroller": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-x-socialsharing": {
        "PHOTO_LIBRARY_ADD_USAGE_DESCRIPTION": "This app requires photo library access to function properly.",
        "PHOTO_LIBRARY_USAGE_DESCRIPTION": "This app requires photo library access to function properly."
      },
      "cordova-plugin-network-information": {},
      "cordova-plugin-advanced-http": {
        "ANDROIDBLACKLISTSECURESOCKETPROTOCOLS": "SSLv3,TLSv1"
      },
      "cordova-plugin-customurlscheme": {
        "URL_SCHEME": "admint"
      },
      "cordova-plugin-sign-in-with-apple": {},
      "cordova-plugin-taptic-engine": {},
      "cordova-plugin-qrscanner": {},
      "cordova-plugin-firebase-messaging": {
        "ANDROID_FIREBASE_MESSAGING_VERSION": "22.0.+",
        "ANDROIDX_CORE_VERSION": "1.6.+",
        "IOS_FIREBASE_POD_VERSION": "~> 8.8.0"
      },
      "cordova-plugin-firebase-analytics": {},
      "cordova-plugin-proguard": {},
      "cordova-plugin-nativeclicksound": {}
    },
    "platforms": [
      "android",
      "ios"
    ]
  },
  "devDependencies": {
    "cordova-android": "^9.1.0",
    "cordova-ios": "^6.2.0",
    "cordova-plugin-add-swift-support": "^2.0.2",
    "cordova-plugin-advanced-http": "^3.2.2",
    "cordova-plugin-analytics": "^2.0.0",
    "cordova-plugin-file": "^6.0.2",
    "cordova-plugin-firebase-analytics": "^6.1.0",
    "cordova-plugin-firebase-messaging": "^6.1.0",
    "cordova-plugin-nativeclicksound": "0.0.4",
    "cordova-plugin-network-information": "^3.0.0",
    "cordova-plugin-proguard": "^2.2.0",
    "cordova-plugin-purchase": "^10.6.1",
    "cordova-plugin-qrscanner": "^3.0.1",
    "cordova-plugin-sign-in-with-apple": "^0.1.2",
    "cordova-plugin-taptic-engine": "^2.2.0",
    "cordova-plugin-whitelist": "^1.3.5",
    "cordova-plugin-x-socialsharing": "^6.0.3",
    "cordova-support-android-plugin": "^1.0.2",
    "es6-promise-plugin": "^4.2.2",
    "jetifier": "^2.0.0"
  }
}

Exact same configuration (Certificates, jsons, etc..) on cordova-plugin-firebasex works with no problems, so its definitely a plugin issue.

Hi @chemerisuk I had the same problem and it was solved after adding those rules, should I add a new description on the project readme?