Ionic 5 + Capacitor 3 - Push notification and Analytics

Hi!, I started a new app and added @capacitor/push-notifications and it was working fine. Then I added @capacitor-community/firebase-analytics and push notification stopped working for android.

Line 1 - Msg: Ionic Native: deviceready event fired after 230 ms
Line 1 - Msg: Initializing HomePage
Line 1 - Msg: ERROR Error: Uncaught (in promise): Error: "PushNotifications" plugin is not implemented on android
    Error: "PushNotifications" plugin is not implemented on android

Any advice how to use Firebase with ionic/capacitor 3?

plz share package.json in your project.

  1. make sure if you installed the latest version of capacitor packages.
  2. try this.
  • remove android directory
  • ionic build
  • npx cap add android
  • npx cap sync android
  • npx cap open android

let me know if this works

  "name": "testapp",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "https://ionicframework.com/",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "~12.1.1",
    "@angular/core": "~12.1.1",
    "@angular/forms": "~12.1.1",
    "@angular/platform-browser": "~12.1.1",
    "@angular/platform-browser-dynamic": "~12.1.1",
    "@angular/router": "~12.1.1",
    "@capacitor-community/firebase-analytics": "^1.0.0",
    "@capacitor/android": "3.2.2",
    "@capacitor/app": "1.0.3",
    "@capacitor/core": "3.2.2",
    "@capacitor/haptics": "1.0.3",
    "@capacitor/ios": "3.2.2",
    "@capacitor/keyboard": "1.0.3",
    "@capacitor/push-notifications": "^1.0.4",
    "@capacitor/status-bar": "1.0.3",
    "@ionic-native/barcode-scanner": "^5.36.0",
    "@ionic-native/core": "^5.36.0",
    "@ionic/angular": "^5.5.2",
    "@mapbox/mapbox-sdk": "^0.13.2",
    "@types/mapbox-gl": "^2.4.1",
    "firebase": "^9.0.0",
    "mapbox-gl": "^2.4.1",
    "phonegap-plugin-barcodescanner": "^8.1.0",
    "rxfire": "^6.0.0",
    "rxjs": "~6.6.0",
    "tslib": "^2.2.0",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/architect": "^0.1200.0",
    "@angular-devkit/build-angular": "~12.1.1",
    "@angular-eslint/builder": "~12.0.0",
    "@angular-eslint/eslint-plugin": "~12.0.0",
    "@angular-eslint/eslint-plugin-template": "~12.0.0",
    "@angular-eslint/template-parser": "~12.0.0",
    "@angular/cli": "~12.1.1",
    "@angular/compiler": "~12.1.1",
    "@angular/compiler-cli": "~12.1.1",
    "@angular/language-service": "~12.0.1",
    "@capacitor/cli": "3.2.2",
    "@ionic/angular-toolkit": "^4.0.0",
    "@types/jasmine": "~3.6.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^12.11.1",
    "@typescript-eslint/eslint-plugin": "4.16.1",
    "@typescript-eslint/parser": "4.16.1",
    "eslint": "^7.6.0",
    "eslint-plugin-import": "2.22.1",
    "eslint-plugin-jsdoc": "30.7.6",
    "eslint-plugin-prefer-arrow": "1.2.2",
    "firebase-tools": "^9.0.0",
    "fuzzy": "^0.1.3",
    "inquirer": "^6.2.2",
    "inquirer-autocomplete-prompt": "^1.0.1",
    "jasmine-core": "~3.8.0",
    "jasmine-spec-reporter": "~5.0.0",
    "jsonc-parser": "^3.0.0",
    "karma": "~6.3.2",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.0.3",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "open": "^7.0.3",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "typescript": "~4.2.4"
  },
  "description": "An Ionic project"
}

You did a great job of reporting your problem, to the point where simply reading your description suggests what is wrong (installing @capacitor-community/firebase-analytics) and what to do (uninstall it).

It seems that that plugin is not compatible with Capacitor 3, so you should either (a) find an alternative, (b) wait for upstream to fix it, or (c) fork it yourself. If you go with (b) or (c), I’d follow #106.