Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

On Android it receives notifications but they don't appear on Firebase Analytics #2931

Open
esteves-esta opened this issue Jun 29, 2020 · 0 comments

Comments

@esteves-esta
Copy link

Expected Behaviour

Send notification via Firebase Console.
On the Firebase Console on Analytics should show evidence that the push notification was received on iOS and Android.

Actual Behaviour

Send notification via Firebase Console.
On the Firebase Console on Analytics it shows only for iOS the evidence that the push notification was received, Android is receving push notifications but it does not show on Firebase console.

Reproduce Scenario (including but not limited to)

Sending notifications from Firebase Console to Android and also just for a specific device by the device id.

Steps to Reproduce

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

Android 6.0.1

(Android) What device vendor (e.g. Samsung, HTC, Sony...)

Samsung Galaxy J7

Cordova CLI version and cordova platform version

Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 8.1.0

Plugin version

"phonegap-plugin-push": "^2.3.0",

Sample Push Data Payload

I'm using the firebase console to send push notifications.

Sample Code that illustrates the problem

export class PushNotificationsProvider {
  private pushObject: PushObject;


  constructor(
    private push: Push,
    private platform: Platform,
    private alertCtrl: AlertController,
  ) {

  }

  showNotification() {
    this.platform.ready().then(() => {
      if (this.platform.is("cordova")) {
        if (this.platform.is("android") || this.platform.is("ios")) {
          this.push.hasPermission().then((res: any) => {
            if (res.isEnabled) {
              console.log("We have permission to send push notifications");
            } else {
              console.log(
                "We do not have permission to send push notifications"
              );
            }
          });

          const options: PushOptions = {
            android: {
              vibrate: true,
            },
            ios: {
              alert: "true",
              badge: "true",
              sound: "false",
            },
          };

          const pushObject: PushObject = this.push.init(options);

          pushObject.on("notification").subscribe((notification: any) => {
            this.alertCtrl
              .create({
                title: notification.title,
                message: notification.message,
                cssClass: "cssClass",
                buttons: ["Ok"],
              })
              .present();
          });

          pushObject.on("registration").subscribe(
            (registration: any) =>
              console.log("Device registered " + registration.registrationId)
          );

          pushObject.on("error").subscribe((error: any) => {
            console.log("Error with Push plugin " + error);
          });
        }
      }
    });
  }
}

our dependencies on package.json

"dependencies": {
    "@angular/animations": "5.2.11",
    "@angular/common": "5.2.11",
    "@angular/compiler": "5.2.11",
    "@angular/compiler-cli": "5.2.11",
    "@angular/core": "5.2.11",
    "@angular/forms": "5.2.11",
    "@angular/http": "5.2.11",
    "@angular/platform-browser": "5.2.11",
    "@angular/platform-browser-dynamic": "5.2.11",
    "@ionic-native/app-center-analytics": "^4.20.0",
    "@ionic-native/app-version": "^4.20.0",
    "@ionic-native/barcode-scanner": "^4.9.1",
    "@ionic-native/contacts": "^4.9.1",
    "@ionic-native/core": "4.7.0",
    "@ionic-native/device": "^4.8.0",
    "@ionic-native/keyboard": "^4.20.0",
    "@ionic-native/network": "^4.8.0",
    "@ionic-native/push": "^4.20.0",
    "@ionic-native/social-sharing": "^5.26.0",
    "@ionic-native/splash-screen": "4.7.0",
    "@ionic-native/status-bar": "4.7.0",
    "@ionic/storage": "^2.2.0",
    "@pluritech/ion-currencymask": "^1.0.4",
    "chart.js": "^2.7.2",
    "com.pylonproducts.wifiwizard": "https://github.com/hoerresb/WifiWizard",
    "cordova-android": "^8.1.0",
    "cordova-browser": "5.0.4",
    "cordova-ios": "5.1.1",
    "cordova-plugin-app-version": "^0.1.9",
    "cordova-plugin-appcenter-analytics": "^0.5.1",
    "cordova-plugin-appcenter-crashes": "^0.5.1",
    "cordova-plugin-appcenter-shared": "^0.5.1",
    "cordova-plugin-compat": "^1.2.0",
    "cordova-plugin-contacts": "^3.0.1",
    "cordova-plugin-contacts-phonenumbers": "0.0.12",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-inappbrowser": "^3.2.0",
    "cordova-plugin-ionic-keyboard": "^2.1.2",
    "cordova-plugin-ionic-webview": "^1.2.1",
    "cordova-plugin-network-information": "^2.0.1",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "cordova-plugin-wkwebview-engine": "^1.2.1",
    "cordova-plugin-x-socialsharing": "^5.6.8",
    "cordova-sqlite-storage": "^5.0.0",
    "cordova-support-google-services": "^1.3.2",
    "es6-promise-plugin": "^4.2.2",
    "font-awesome": "^4.7.0",
    "ionic-angular": "3.9.2",
    "ionicons": "3.0.0",
    "mx.ferreyra.callnumber": "0.0.2",
    "phonegap-plugin-barcodescanner": "git+https://github.com/jrontend/phonegap-plugin-barcodescanner.git",
    "phonegap-plugin-multidex": "^1.0.0",
    "phonegap-plugin-push": "^2.3.0",
    "rxjs": "5.5.11",
    "sw-toolbox": "3.6.0",
    "wifiwizard": "git+https://github.com/hoerresb/WifiWizard.git",
    "zone.js": "0.8.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "3.1.10",
    "@ionic/lab": "1.0.9",
    "typescript": "~2.6.2"
  },
  "cordova": {
    "plugins": {
      "com.pylonproducts.wifiwizard": {},
      "phonegap-plugin-barcodescanner": {
        "ANDROID_SUPPORT_V4_VERSION": "27.+"
      },
      "cordova-plugin-contacts": {},
      "cordova-plugin-contacts-phonenumbers": {
        "CONTACTS_USAGE_DESCRIPTION": "This app needs contacts access"
      },
      "cordova-plugin-inappbrowser": {},
      "cordova-sqlite-storage": {},
      "cordova-plugin-wkwebview-engine": {},
      "mx.ferreyra.callnumber": {},
      "cordova-plugin-x-socialsharing": {
        "ANDROID_SUPPORT_V4_VERSION": "24.1.1+"
      },
      "cordova-plugin-device": {},
      "cordova-plugin-network-information": {},
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-whitelist": {},
      "cordova-plugin-appcenter-analytics": {},
      "cordova-plugin-appcenter-crashes": {},
      "call-number": {},
      "cordova-plugin-app-version": {},
      "phonegap-plugin-push": {
        "ANDROID_SUPPORT_V13_VERSION": "27.+",
        "FCM_VERSION": "11.6.2",
        "SENDER_ID": "OUR_SENDER_ID"
      },
      "cordova-plugin-ionic-webview": {}
    },

Logs taken while reproducing problem

06-29 10:51:33.406 29299 29299 D FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
06-29 10:51:33.416 29299 29299 D FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
06-29 10:51:33.416 29299 29299 I FirebaseInitProvider: FirebaseApp initialization successful
06-29 10:51:33.416 29289 29289 D FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
06-29 10:51:33.416 29289 29289 D FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
06-29 10:51:33.416 29289 29289 I FirebaseInitProvider: FirebaseApp initialization successful
06-29 10:51:33.446 29275 29275 D FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
06-29 10:51:33.446 29275 29275 D FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
06-29 10:51:33.446 29275 29275 I FirebaseInitProvider: FirebaseApp initialization successful

06-29 10:51:33.976 29299 29343 I FA      : Collection disabled with firebase_analytics_collection_enabled=0
06-29 10:51:33.976 29275 29348 I FA      : Collection disabled with firebase_analytics_collection_enabled=0
06-29 10:51:33.976 29299 29343 I FA      : App measurement is starting up, version: 14710
06-29 10:51:33.976 29275 29348 I FA      : App measurement is starting up, version: 14710
06-29 10:51:33.976 29299 29343 I FA      : To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
06-29 10:51:33.976 29275 29348 I FA      : To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
06-29 10:51:33.976 29299 29343 I FA      : To enable faster debug mode event logging run:
06-29 10:51:33.976 29299 29343 I FA      :   adb shell setprop debug.firebase.analytics.app com.microsoft.office.word
06-29 10:51:33.976 29275 29348 I FA      : To enable faster debug mode event logging run:
06-29 10:51:33.976 29275 29348 I FA      :   adb shell setprop debug.firebase.analytics.app com.microsoft.office.powerpoint
06-29 10:51:33.996 29289 29345 I FA      : Collection disabled with firebase_analytics_collection_enabled=0
06-29 10:51:33.996 29289 29345 I FA      : App measurement is starting up, version: 14710
06-29 10:51:33.996 29289 29345 I FA      : To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
06-29 10:51:33.996 29289 29345 I FA      : To enable faster debug mode event logging run:
06-29 10:51:33.996 29289 29345 I FA      :   adb shell setprop debug.firebase.analytics.app com.microsoft.office.excel
06-29 10:51:34.016  4457  4821 D ActivityManager: removeProcessNameLocked mProcessNames.remove pid=27215 ,hash=259887401 ,name=com.samsung.android.SettingsReceiver

06-29 10:51:36.276 29309 29309 D FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
06-29 10:51:36.346 29309 29309 I FirebaseInitProvider: FirebaseApp initialization successful
06-29 10:51:36.346 29309 29437 W DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
06-29 10:51:36.376 29309 29437 I FirebaseAuth: [FirebaseAuth:] Loading module via FirebaseOptions.
06-29 10:51:36.376 29309 29437 I FirebaseAuth: [FirebaseAuth:] Preparing to create service connection to gms implementation
06-29 10:51:36.426 29309 29438 I FA      : App measurement is starting up, version: 14711
06-29 10:51:36.426 29309 29438 I FA      : To enable debug logging run: adb shell setprop log.tag.FA VERBOSE
06-29 10:51:36.426 29309 29438 I FA      : To enable faster debug mode event logging run:
06-29 10:51:36.426 29309 29438 I FA      :   adb shell setprop debug.firebase.analytics.app com.microsoft.skydrive

06-29 11:10:06.346  1045  2709 W FirebaseMessaging: Unable to log event: analytics library is missing
06-29 11:10:06.346  1045  2709 W FirebaseMessaging: Unable to log event: analytics library is missing
06-29 11:10:06.356  1045  2709 D Push_FCMService: onMessage - from: SENDERID
06-29 11:10:06.356  1045  2709 D Push_FCMService: sender id = SENDERID
06-29 11:10:06.356  1045  2709 D Push_FCMService: normalize extras
06-29 11:10:06.356  1045  2709 D Push_FCMService: key = icon
06-29 11:10:06.356  1045  2709 D Push_FCMService: replace key icon with icon
06-29 11:10:06.356  1045  2709 D Push_FCMService: key = color
06-29 11:10:06.356  1045  2709 D Push_FCMService: replace key color with color
06-29 11:10:06.356  1045  2709 D Push_FCMService: key = sound
06-29 11:10:06.356  1045  2709 D Push_FCMService: replace key sound with sound
06-29 11:10:06.356  1045  2709 D Push_FCMService: key = title
06-29 11:10:06.356  1045  2709 D Push_FCMService: replace key title with title
06-29 11:10:06.366  1045  2709 D Push_FCMService: no locale found for key = title, error Value Thanks of type java.lang.String cannot be converted to JSONObject
06-29 11:10:06.366  1045  2709 D Push_FCMService: key = message
06-29 11:10:06.366  1045  2709 D Push_FCMService: replace key message with message
06-29 11:10:06.366  1045  2709 D Push_FCMService: no locale found for key = message, error Value Welcome of type java.lang.String cannot be converted to JSONObject
06-29 11:10:06.366  1045  2709 D Push_FCMService: foreground
06-29 11:10:06.366  1045  2709 D Push_Plugin: convert extras to json
06-29 11:10:06.366  1045  2709 D Push_Plugin: key = title
06-29 11:10:06.366  1045  2709 D Push_Plugin: key = message
06-29 11:10:06.366  1045  2709 D Push_Plugin: key = coldstart
06-29 11:10:06.366  1045  2709 D Push_Plugin: key = foreground
06-29 11:10:06.366  1045  2709 V Push_Plugin: extrasToJSON: {"title":"Welcome","message":"Thanks for installing our app.","additionalData":{"coldstart":false,"foreground":true}}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant