Giter Site home page Giter Site logo

andrehtissot / cordova-plugin-fcm-with-dependecy-updated Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fechanique/cordova-plugin-fcm

210.0 16.0 272.0 17.97 MB

Google FCM Push Notifications Cordova Plugin

License: MIT License

JavaScript 17.70% Java 21.04% Objective-C 31.87% Ruby 6.10% Shell 4.69% TypeScript 18.42% Batchfile 0.18%

cordova-plugin-fcm-with-dependecy-updated's Introduction

⚠️ After 3 years of developing and maintaining this plugin, due to the lack of sponsorship from the community and more promising opportunities, this project is now frozen. Anyone can clone and continue the good work. ⚠️

Google Firebase Cloud Messaging Cordova Push Plugin

Extremely easy plug&play push notification plugin for Cordova applications with Google Firebase FCM.

Donate npm downloads npm per month npm version License: MIT GitHub issues GitHub forks GitHub stars Known Vulnerabilities DeepScan grade

How it works | Installation | Push Payload Configuration | Features | Example Apps | Companion Plugins | Changelog | Authorship

How it works

Send a push notification to a single device or topic.

  • Application is in foreground:

    • The notification data is received in the JavaScript callback without notification bar message (this is the normal behavior of mobile push notifications).
    • For Android, to show the notification received on the foreground, it's recommended to use cordova-plugin-local-notification as it provides many presentation and interaction features.
  • Application is in background or closed:

    • The device displays the notification message in the device notification bar.
    • If the user taps the notification, the application comes to foreground and the notification data is received in the JavaScript callback.
    • If the user does not tap the notification but opens the application, nothing happens until the notification is tapped.

Push Notifications on iOS

On Android, push notifications don't require any special permission and can be tested from emulators freely.

Unfortunately, Apple is not as nice to work with, requiring:

  • The running device to be a real device, no simulators allowed;
  • Application has require the UIBackgroundModes=[remote-notification] permission (automatically configured by this plugin);
  • The user running the application has to manually allow the application to receive push notifications;
  • The application must be build with credentials created from a paid account (or team) that is allowed to receive push notifications;
  • The build installed has to have come from either Apple Store or TestFlight; Or, be build with a special certificate (https://customersupport.doubledutch.me/hc/en-us/articles/229495568-iOS-How-to-Create-a-Push-Notification-Certificate)

Installation

Make sure you have ‘google-services.json’ for Android and/or ‘GoogleService-Info.plist’ for iOS in your Cordova project root folder.

Preferences

Preference Default Value Description
ANDROID_DEFAULT_NOTIFICATION_ICON @mipmap/ic_launcher Default notification icon.
ANDROID_FCM_VERSION 21.0.0 Native Firebase Message SDK version.
⚠️ Replaced by BoM versioning on Gradle >= 3.4.
ANDROID_FIREBASE_BOM_VERSION 26.0.0 Firebase BoM version.
ANDROID_GOOGLE_SERVICES_VERSION 4.3.4 Native Google Services SDK version.
ANDROID_GRADLE_TOOLS_VERSION 4.1.0 Gradle tools version.
IOS_FIREBASE_MESSAGING_VERSION ~> 7.4.0 Native Firebase Message SDK version

Cordova

Default preferences:

npm install -g cordova@latest # Version 9 or higher required
npm uninstall @ionic-native/fcm # Ionic support is included and conflicts with @ionic-native's implementation.
cordova plugin add cordova-plugin-fcm-with-dependecy-updated

Complete:

npm install -g cordova@latest # Version 9 or higher required
npm uninstall @ionic-native/fcm # Ionic support is included and conflicts with @ionic-native's implementation.
cordova plugin add cordova-plugin-fcm-with-dependecy-updated \
  --variable ANDROID_DEFAULT_NOTIFICATION_ICON="@mipmap/ic_launcher" \
  --variable ANDROID_FIREBASE_BOM_VERSION="26.0.0" \
  --variable ANDROID_GOOGLE_SERVICES_VERSION="4.3.4" \
  --variable ANDROID_GRADLE_TOOLS_VERSION="4.1.0" \
  --variable IOS_FIREBASE_MESSAGING_VERSION="~> 7.4.0"

Ionic

Default preferences:

npm install -g cordova@latest # Version 9 or higher required
npm uninstall @ionic-native/fcm # Ionic support is included and conflicts with @ionic-native's implementation.
ionic cordova plugin add cordova-plugin-fcm-with-dependecy-updated

Complete:

npm install -g cordova@latest # Version 9 or higher required
npm uninstall @ionic-native/fcm # Ionic support is included and conflicts with @ionic-native's implementation.
ionic cordova plugin add cordova-plugin-fcm-with-dependecy-updated \
  --variable ANDROID_DEFAULT_NOTIFICATION_ICON="@mipmap/ic_launcher" \
  --variable ANDROID_FIREBASE_BOM_VERSION="26.0.0" \
  --variable ANDROID_GOOGLE_SERVICES_VERSION="4.3.4" \
  --variable ANDROID_GRADLE_TOOLS_VERSION="4.1.0" \
  --variable IOS_FIREBASE_MESSAGING_VERSION="~> 7.4.0"

Push Payload Configuration

Besides common FCM configuration (https://firebase.google.com/docs/cloud-messaging/ios/certs), the Push payload should contain "notification" and "data" keys and "click_action" equals to "FCM_PLUGIN_ACTIVITY" within "notification".

Structure expected:

{
  ...,
  "notification": {
    ...
  },
  "data": {
    ...
  },
  "android": {
    "notification": {
      "click_action": "FCM_PLUGIN_ACTIVITY"
    }
  },
  ...,
}

Example:

{
  "token": "[FCM token]",
  "notification":{
    "title":"Notification title",
    "body":"Notification body",
    "sound":"default",
  },
  "data":{
    "param1":"value1",
    "param2":"value2"
  },
  "android": {
    "notification": {
      "icon":"fcm_push_icon",
      "click_action": "FCM_PLUGIN_ACTIVITY"
    }
  }
}

Features

As its own

The JS functions are now as written bellow and do require Promise support. Which, for Android API 19 support, it can be fulfilled by a polyfill.

FCM.clearAllNotifications()

Removes existing push notifications from the notifications center.

await FCM.clearAllNotifications();
FCM.createNotificationChannel()

For Android, some notification properties are only defined programmatically. Channel can define the default behavior for notifications on Android 8.0+. Once a channel is created, it stays unchangeable until the user uninstalls the app.

await FCM.createNotificationChannel({
  id: "urgent_alert", // required
  name: "Urgent Alert", // required
  description: "Very urgent message alert",
  importance: "high", // https://developer.android.com/guide/topics/ui/notifiers/notifications#importance
  visibility: "public", // https://developer.android.com/training/notify-user/build-notification#lockscreenNotification
  sound: "alert_sound", // In the "alert_sound" example, the file should located as resources/raw/alert_sound.mp3
  lights: true, // enable lights for notifications
  vibration: true // enable vibration for notifications
});
FCM.deleteInstanceId()

Deletes the InstanceId, revoking all tokens.

await FCM.deleteInstanceId();
FCM.getAPNSToken()

Gets iOS device's current APNS token.

const apnsToken: string = await FCM.getAPNSToken();
FCM.getInitialPushPayload()

Retrieves the message that, on tap, opened the app. And null, if the app was open normally.

const pushPayload: object = await FCM.getInitialPushPayload()
FCM.getToken()

Gets device's current registration id.

const fcmToken: string = await FCM.getToken()
FCM.hasPermission()

Checking for permissions on iOS. On android, it always returns true.

const doesIt: boolean = await FCM.hasPermission()
FCM.onNotification()

Callback firing when receiving new notifications. It serves as a shortcut to listen to eventTarget's "notification" event.

const disposable = FCM.onNotification((payload: object) => {
  // ...
})
// ...
disposable.dispose() // To remove listener

⚠️ If the subscription to notification events happens after the notification has been fired, it'll be lost. As it is expected that you'd not always be able to catch the notification payload that the opened the app, the FCM.getInitialPushPayload() method was introduced.

FCM.onTokenRefresh()

Callback firing when receiving a new Firebase token. It serves as a shortcut to listen to eventTarget's "tokenRefresh" event.

const disposable = FCM.onTokenRefresh((fcmToken: string) => {
  // ...
})
// ...
disposable.dispose() // To remove listener
FCM.requestPushPermission()

Request push notification permission on iOS, alerting the user if he/she/they have not yet accepted or denied. For Android, it'll always return true.

const wasPermissionGiven: boolean = await FCM.requestPushPermission({
  ios9Support: {
    timeout: 10,  // How long it will wait for a decision from the user before returning `false`
    interval: 0.3 // How long between each permission verification
  }
})

⚠️ Without this request, the Application won't receive any notification on iOS! ⚠️ The user will only have its permition required once, after that time, this call will only return if the permission was given that time.

FCM.subscribeToTopic()

Subscribes you to a topic.

const topic: string
// ...
await FCM.subscribeToTopic(topic)
FCM.unsubscribeFromTopic()

Unsubscribes you from a topic.

const topic: string
// ...
await FCM.unsubscribeFromTopic(topic)
FCM.eventTarget

EventTarget object for native-sourced custom events. Useful for more advanced listening handling.

const listener = (data) => {
  const payload = data.detail
  // ...
}
FCM.eventTarget.addEventListener("notification", listener, false);
// ...
FCM.eventTarget.removeEventListener("notification", listener, false);

With Ionic

Ionic support was implemented as part of this plugin to allow users to have access to newer features with the type support. It is available in 3 flavors:

  • Ionic v5:
import { FCM } from "cordova-plugin-fcm-with-dependecy-updated/ionic";
  • Ionic ngx:
import { FCM } from "cordova-plugin-fcm-with-dependecy-updated/ionic/ngx";
  • Ionic v4 (also works for Ionic v3):
import { FCM } from "cordova-plugin-fcm-with-dependecy-updated/ionic/v4";

It brings the same behavior as the native implementation, except for FCM.onNotification() and FCM.onTokenRefresh(), which gain rxjs' Observable support.

To avoid confusion, it's suggested to also remove the redundant @ionic-native/fcm package.

FCM.onNotification()

Event firing when receiving new notifications.

this.fcm.onNotification().subscribe((payload: object) => {
  // ...
});
FCM.onTokenRefresh()

Event firing when receiving a new Firebase token.

this.fcm.onTokenRefresh().subscribe((token: string) => {
  // ...
});

Example Apps

Cordova

https://github.com/andrehtissot/cordova-plugin-fcm-with-dependecy-updated-app-example

Ionic v3

https://github.com/andrehtissot/cordova-plugin-fcm-with-dependecy-updated-ionic-v3-example

Ionic v5

https://github.com/andrehtissot/cordova-plugin-fcm-with-dependecy-updated-ionic-v5-example

Companion Plugins

Optional standalone FCM Image Support for Cordova iOS

After a lot of work, the first release of the plugin is out. Which should enable the support, just by installing it.

Link: https://github.com/andrehtissot/cordova-plugin-fcm-image-support

Optional standalone Cocoapods CDN source switcher

When the environment supports, the cocoapods source is automatically set to the official CDN instead of the slow Github repository.

Link: https://github.com/andrehtissot/cordova-plugin-cocoapods-cdn

Authorship

This started as a fork from https://github.com/fechanique/cordova-plugin-fcm and, gradually, had most of its implementation rewritten and improved, for newer dependency versions support, jitpack and cocoapods support, and new useful features.

cordova-plugin-fcm-with-dependecy-updated's People

Contributors

allisson95 avatar anastasiao avatar andrehtissot avatar andretissot avatar aparedes avatar aserranoo avatar av-alex avatar bryant1410 avatar cesarak avatar fechanique avatar fechaniqueleadclic avatar florian-diatelic avatar gregordy avatar jach145 avatar jorchg avatar ketanyekale avatar lp1bp avatar luiscontrerasm avatar mfdeveloper avatar nikmartin avatar quentinfarizon avatar rich186 avatar vlavrynovych avatar wilsonpinto avatar yeener avatar yemyigit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cordova-plugin-fcm-with-dependecy-updated's Issues

Version >=5.1.0 not compatible with latest cordova-plugin-ionic-webview

Problem

  • cordova-plugin-fcm-with-dependecy-updated 6.0.0 depend on / installs cordova-plugin-wkwebview-engine 1.2.1
  • cordova-plugin-ionic 5.4.7 depend on /installs cordova-plugin-ionic-webview 4.2.0
  • cordova-plugin-ionic-webview 4.2.0 and cordova-plugin-wkwebview-engine 1.2.1 are not compatible for iOS

Pointers

  • This gives a linking error when building app in xcode related to duplicate symbols.
  • Confirmed that app builds if cordova-plugin-fcm-with-dependecy-updated 6.0.0 and cordova-plugin-wkwebview-engine are removed
  • Configuration works if cordova-plugin-fcm-with-dependecy-updated < 5.0.0 is installed. Hence the problem is related to installation of cordova-plugin-wkwebview-engine.

Debug info

`cordova plugin ls

cordova-clipboard 1.3.0 "Clipboard"
cordova-plugin-androidx 1.0.2 "cordova-plugin-androidx"
cordova-plugin-androidx-adapter 1.1.0 "cordova-plugin-androidx-adapter"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-appavailability 0.4.2 "AppAvailability"
cordova-plugin-badge 0.8.8 "Badge"
cordova-plugin-calendar 5.1.5 "Calendar"
cordova-plugin-camera 4.1.0 "Camera"
cordova-plugin-compat 1.2.0 "Compat"
cordova-plugin-contacts 3.0.1 "Contacts"
cordova-plugin-datepicker 0.9.3 "DatePicker"
cordova-plugin-device 2.0.3 "Device"
cordova-plugin-facebook4 6.4.0 "Facebook Connect"
cordova-plugin-fcm-with-dependecy-updated 6.0.0 "Cordova FCM Push Plugin"
cordova-plugin-file 6.0.2 "File"
cordova-plugin-geolocation 4.0.2 "Geolocation"
cordova-plugin-globalization 1.11.0 "Globalization"
cordova-plugin-inappbrowser 3.2.0 "InAppBrowser"
cordova-plugin-ionic 5.4.7 "cordova-plugin-ionic"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 4.2.0 "cordova-plugin-ionic-webview"
cordova-plugin-localization-strings 3.2.1 "Localization"
cordova-plugin-mixpanel 4.7.0 "Mixpanel"
cordova-plugin-network-information 2.0.2 "Network Information"
cordova-plugin-splashscreen 5.0.3 "Splashscreen"
cordova-plugin-statusbar 2.4.3 "StatusBar"
cordova-plugin-vibration 3.1.1 "Vibration"
cordova-plugin-whitelist 1.3.4 "Whitelist"
cordova-plugin-wkwebview-engine 1.2.1 "Cordova WKWebView Engine"
cordova-support-google-services 1.4.0 "cordova-support-google-services"`

Xcode build error

duplicate symbol '_OBJC_IVAR_$_CDVWKWebViewEngine._engineWebView' in: /Users/quinn/Library/Developer/Xcode/DerivedData/ViVil-atsknnogohyfhresoxzxhsvqezgf/Build/Intermediates.noindex/ViVil.build/Debug-iphoneos/ViVil.build/Objects-normal/arm64/CDVWKWebViewEngine-FEF233EC3699DE82.o /Users/quinn/Library/Developer/Xcode/DerivedData/ViVil-atsknnogohyfhresoxzxhsvqezgf/Build/Intermediates.noindex/ViVil.build/Debug-iphoneos/ViVil.build/Objects-normal/arm64/CDVWKWebViewEngine-1200E40279F635B2.o duplicate symbol '_OBJC_IVAR_$_CDVWKWeakScriptMessageHandler._scriptMessageHandler' in: /Users/quinn/Library/Developer/Xcode/DerivedData/ViVil-atsknnogohyfhresoxzxhsvqezgf/Build/Intermediates.noindex/ViVil.build/Debug-iphoneos/ViVil.build/Objects-normal/arm64/CDVWKWebViewEngine-FEF233EC3699DE82.o /Users/quinn/Library/Developer/Xcode/DerivedData/ViVil-atsknnogohyfhresoxzxhsvqezgf/Build/Intermediates.noindex/ViVil.build/Debug-iphoneos/ViVil.build/Objects-normal/arm64/CDVWKWebViewEngine-1200E40279F635B2.o duplicate symbol '_OBJC_IVAR_$_CDVWKWebViewEngine._weakScriptMessageHandler' in: /Users/quinn/Library/Developer/Xcode/DerivedData/ViVil-atsknnogohyfhresoxzxhsvqezgf/Build/Intermediates.noindex/ViVil.build/Debug-iphoneos/ViVil.build/Objects-normal/arm64/CDVWKWebViewEngine-FEF233EC3699DE82.o /Users/quinn/Library/Developer/Xcode/DerivedData/ViVil-atsknnogohyfhresoxzxhsvqezgf/Build/Intermediates.noindex/ViVil.build/Debug-iphoneos/ViVil.build/Objects-normal/arm64/CDVWKWebViewEngine-1200E40279F635B2.o duplicate symbol '_OBJC_CLASS_$_CDVWKWeakScriptMessageHandler' in: /Users/quinn/Library/Developer/Xcode/DerivedData/ViVil-atsknnogohyfhresoxzxhsvqezgf/Build/Intermediates.noindex/ViVil.build/Debug-iphoneos/ViVil.build/Objects-normal/arm64/CDVWKWebViewEngine-FEF233EC3699DE82.o /Users/quinn/Library/Developer/Xcode/DerivedData/ViVil-atsknnogohyfhresoxzxhsvqezgf/Build/Intermediates.noindex/ViVil.build/Debug-iphoneos/ViVil.build/Objects-normal/arm64/CDVWKWebViewEngine-1200E40279F635B2.o duplicate symbol '_OBJC_METACLASS_$_CDVWKWeakScriptMessageHandler' in: /Users/quinn/Library/Developer/Xcode/DerivedData/ViVil-atsknnogohyfhresoxzxhsvqezgf/Build/Intermediates.noindex/ViVil.build/Debug-iphoneos/ViVil.build/Objects-normal/arm64/CDVWKWebViewEngine-FEF233EC3699DE82.o /Users/quinn/Library/Developer/Xcode/DerivedData/ViVil-atsknnogohyfhresoxzxhsvqezgf/Build/Intermediates.noindex/ViVil.build/Debug-iphoneos/ViVil.build/Objects-normal/arm64/CDVWKWebViewEngine-1200E40279F635B2.o duplicate symbol '_OBJC_IVAR_$_CDVWKWebViewEngine._uiDelegate' in: /Users/quinn/Library/Developer/Xcode/DerivedData/ViVil-atsknnogohyfhresoxzxhsvqezgf/Build/Intermediates.noindex/ViVil.build/Debug-iphoneos/ViVil.build/Objects-normal/arm64/CDVWKWebViewEngine-FEF233EC3699DE82.o /Users/quinn/Library/Developer/Xcode/DerivedData/ViVil-atsknnogohyfhresoxzxhsvqezgf/Build/Intermediates.noindex/ViVil.build/Debug-iphoneos/ViVil.build/Objects-normal/arm64/CDVWKWebViewEngine-1200E40279F635B2.o duplicate symbol '_OBJC_CLASS_$_CDVWKWebViewEngine' in: /Users/quinn/Library/Developer/Xcode/DerivedData/ViVil-atsknnogohyfhresoxzxhsvqezgf/Build/Intermediates.noindex/ViVil.build/Debug-iphoneos/ViVil.build/Objects-normal/arm64/CDVWKWebViewEngine-FEF233EC3699DE82.o /Users/quinn/Library/Developer/Xcode/DerivedData/ViVil-atsknnogohyfhresoxzxhsvqezgf/Build/Intermediates.noindex/ViVil.build/Debug-iphoneos/ViVil.build/Objects-normal/arm64/CDVWKWebViewEngine-1200E40279F635B2.o duplicate symbol '_OBJC_METACLASS_$_CDVWKWebViewEngine' in: /Users/quinn/Library/Developer/Xcode/DerivedData/ViVil-atsknnogohyfhresoxzxhsvqezgf/Build/Intermediates.noindex/ViVil.build/Debug-iphoneos/ViVil.build/Objects-normal/arm64/CDVWKWebViewEngine-FEF233EC3699DE82.o /Users/quinn/Library/Developer/Xcode/DerivedData/ViVil-atsknnogohyfhresoxzxhsvqezgf/Build/Intermediates.noindex/ViVil.build/Debug-iphoneos/ViVil.build/Objects-normal/arm64/CDVWKWebViewEngine-1200E40279F635B2.o duplicate symbol '_OBJC_CLASS_$_CDVWKWebViewUIDelegate' in: /Users/quinn/Library/Developer/Xcode/DerivedData/ViVil-atsknnogohyfhresoxzxhsvqezgf/Build/Intermediates.noindex/ViVil.build/Debug-iphoneos/ViVil.build/Objects-normal/arm64/CDVWKWebViewUIDelegate-AB7D11158DD85945.o /Users/quinn/Library/Developer/Xcode/DerivedData/ViVil-atsknnogohyfhresoxzxhsvqezgf/Build/Intermediates.noindex/ViVil.build/Debug-iphoneos/ViVil.build/Objects-normal/arm64/CDVWKWebViewUIDelegate-3DF37D8EAA5EC842.o duplicate symbol '_OBJC_METACLASS_$_CDVWKWebViewUIDelegate' in: /Users/quinn/Library/Developer/Xcode/DerivedData/ViVil-atsknnogohyfhresoxzxhsvqezgf/Build/Intermediates.noindex/ViVil.build/Debug-iphoneos/ViVil.build/Objects-normal/arm64/CDVWKWebViewUIDelegate-AB7D11158DD85945.o /Users/quinn/Library/Developer/Xcode/DerivedData/ViVil-atsknnogohyfhresoxzxhsvqezgf/Build/Intermediates.noindex/ViVil.build/Debug-iphoneos/ViVil.build/Objects-normal/arm64/CDVWKWebViewUIDelegate-3DF37D8EAA5EC842.o duplicate symbol '_OBJC_IVAR_$_CDVWKWebViewUIDelegate._title' in: /Users/quinn/Library/Developer/Xcode/DerivedData/ViVil-atsknnogohyfhresoxzxhsvqezgf/Build/Intermediates.noindex/ViVil.build/Debug-iphoneos/ViVil.build/Objects-normal/arm64/CDVWKWebViewUIDelegate-AB7D11158DD85945.o /Users/quinn/Library/Developer/Xcode/DerivedData/ViVil-atsknnogohyfhresoxzxhsvqezgf/Build/Intermediates.noindex/ViVil.build/Debug-iphoneos/ViVil.build/Objects-normal/arm64/CDVWKWebViewUIDelegate-3DF37D8EAA5EC842.o duplicate symbol '_OBJC_CLASS_$_CDVWKProcessPoolFactory' in: /Users/quinn/Library/Developer/Xcode/DerivedData/ViVil-atsknnogohyfhresoxzxhsvqezgf/Build/Intermediates.noindex/ViVil.build/Debug-iphoneos/ViVil.build/Objects-normal/arm64/CDVWKProcessPoolFactory-5C842A30507E167B.o /Users/quinn/Library/Developer/Xcode/DerivedData/ViVil-atsknnogohyfhresoxzxhsvqezgf/Build/Intermediates.noindex/ViVil.build/Debug-iphoneos/ViVil.build/Objects-normal/arm64/CDVWKProcessPoolFactory-9DAB6944C7B8F8B5.o duplicate symbol '_OBJC_METACLASS_$_CDVWKProcessPoolFactory' in: /Users/quinn/Library/Developer/Xcode/DerivedData/ViVil-atsknnogohyfhresoxzxhsvqezgf/Build/Intermediates.noindex/ViVil.build/Debug-iphoneos/ViVil.build/Objects-normal/arm64/CDVWKProcessPoolFactory-5C842A30507E167B.o /Users/quinn/Library/Developer/Xcode/DerivedData/ViVil-atsknnogohyfhresoxzxhsvqezgf/Build/Intermediates.noindex/ViVil.build/Debug-iphoneos/ViVil.build/Objects-normal/arm64/CDVWKProcessPoolFactory-9DAB6944C7B8F8B5.o duplicate symbol '_OBJC_IVAR_$_CDVWKProcessPoolFactory._sharedPool' in: /Users/quinn/Library/Developer/Xcode/DerivedData/ViVil-atsknnogohyfhresoxzxhsvqezgf/Build/Intermediates.noindex/ViVil.build/Debug-iphoneos/ViVil.build/Objects-normal/arm64/CDVWKProcessPoolFactory-5C842A30507E167B.o /Users/quinn/Library/Developer/Xcode/DerivedData/ViVil-atsknnogohyfhresoxzxhsvqezgf/Build/Intermediates.noindex/ViVil.build/Debug-iphoneos/ViVil.build/Objects-normal/arm64/CDVWKProcessPoolFactory-9DAB6944C7B8F8B5.o ld: 14 duplicate symbols for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation
Tried to clean build, deleting DerivedData among other things.

Build error after installing (Program type already present: android.support.v4.os.ResultReceiver$1)

Hi, I'm not getting to build the app after installing the plugin, gradle fails with D8: Program type already present: android.support.v4.os.ResultReceiver$1 exception

  • What went wrong:
    Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
Program type already present: android.support.v4.os.ResultReceiver$1
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.

Android Background Notification Working.

When the app is in the background and the notification is clicked with "click_action":"FCM_PLUGIN_ACTIVITY" present in the payload the app does not open.
when the above information is not present the app opens but nothing happens ie no alert with payload.

 "registration_ids":["TOKEN_HERE"],
 "notification": {
     "title" : "Title test",
      "body" : "Test message",
      "badge": 1,
      "sound":"default",
      "icon":"fcm_push_icon",
      "click_action":"FCM_PLUGIN_ACTIVITY",
 },
 "data": {
       "title" : "Title test",
       "body" : "Test message",
       "type": "survey",
        "id": ""
  },
 "priority": "high"

when the app is in the foreground the notifications work as expected

No notification sound

I receive the notifications perfectly but without sound, here is my PHP code:

$data = array(	
	"notification" => array( 
		"title" => "$title", 
		"body" => "$message", 				
		"sound" => "default",
		"click_action" => "FCM_PLUGIN_ACTIVITY"
	),
	"data" => array(		
		"test" => "$test",
	),
	"to" => "/topics/testing",
	"priority" => "high"
);

$data_string = json_encode($data); 
    
// FCM API Token URL
$url = "https://fcm.googleapis.com/fcm/send";

// Curl Headers
$headers = array
(
'Authorization: key=' . API_ACCESS_KEY, 
'Content-Type: application/json'
);  

$ch = curl_init();  
curl_setopt($ch, CURLOPT_URL, $url);                                                                 
curl_setopt($ch, CURLOPT_POST, 1);  
curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch,CURLOPT_POSTFIELDS, $data_string);                                                                   
$result = curl_exec($ch);
curl_close ($ch);

The notification appears into the Android tray bar but my phone does not make any notification sound, the strange thing is when i put my phone in only vibration mode it works and the phone vibrates when the notification arrives :/. I also tested via official firebase website (https://console.firebase.google.com/) without any luck.

I have no idea about what is wrong in my App, here is my list of plugins:

cordova-plugin-device 1.1.4 "Device"
cordova-plugin-fcm-with-dependecy-updated 6.0.1 "Cordova FCM Push Plugin"
cordova-plugin-inappbrowser 2.0.2 "InAppBrowser"
cordova-plugin-ionic-keyboard 2.1.3 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 1.1.16 "cordova-plugin-ionic-webview"
cordova-plugin-network-information 2.0.1 "Network Information"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.1 "Whitelist"
cordova-plugin-youtube-video-player 1.0.6 "CordovaYoutubeVideoPlayer"
cordova-sqlite-storage 3.2.0 "Cordova sqlite storage plugin - cordova-sqlite-storage plugin version"

and ionic/android/cordoba versions:

Ionic:

   ionic (Ionic CLI)  : 4.12.0 (C:\Users\admin\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.1

Cordova:

   cordova (Cordova CLI) : 9.0.0 ([email protected])
   Cordova Platforms     : android 8.0.0
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 1.1.1, (and 9 other plugins)

System:

   Android SDK Tools : 26.1.1 (C:\Users\admin\AppData\Local\Android\Sdk)
   NodeJS            : v8.9.4 (C:\Program Files\nodejs\node.exe)
   npm               : 5.6.0
   OS                : Windows 10

I also tried with custom_sound.mp3 in res/raw directory using "sound" => "custom_sound" but also does not work.

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FIRMessagingRemoteMessage mutableCopyWithZone:]: unrecognized selector sent to instance

Hi guys! I'm very much looking forward to using this plugin.. However, I seem to be crashing it on iOS whenever a message is received. The message shows in the console log, but not on the iOS device:

2020-04-14 10:28:54.591270+0200 CordovaTest[1320:2645663] Firebase data message ID: 0:1586852913855163%e119293ae119293a
2020-04-14 10:28:54.591448+0200 CordovaTest[1320:2645663] {
    "collapse_key" = "com.example.cordova.test";
    from = 80079377775;
    notification =     {
        body = "Notification body";
        "click_action" = "FCM_PLUGIN_ACTIVITY";
        e = 1;
        icon = "fcm_push_icon";
        sound = default;
        sound2 = default;
        title = "Notification title";
    };
    param1 = value1;
    param2 = value2;
}
2020-04-14 10:28:54.591519+0200 CordovaTest[1320:2645663] -[FIRMessagingRemoteMessage mutableCopyWithZone:]: unrecognized selector sent to instance 0x28144a740
2020-04-14 10:28:54.591709+0200 CordovaTest[1320:2645663] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FIRMessagingRemoteMessage mutableCopyWithZone:]: unrecognized selector sent to instance 0x28144a740'
*** First throw call stack:
(0x19d17696c 0x19ce8f028 0x19d074dcc 0x19d17b048 0x19d17d3a0 0x1000a583c 0x1000ee528 0x100109254 0x100108b04 0x1000fe110 0x1000f45d4 0x1000f954c 0x1000f7bac 0x100113e14 0x1001139cc 0x10011295c 0x19d10a968 0x19d1078d0 0x19d1076c8 0x1a04cde44 0x1a04d83e8 0x19d0fe2bc 0x19d0f2108 0x19d0f205c 0x19d0f17c8 0x19d0ec694 0x19d0ebf40 0x1a7369534 0x1a1264a60 0x1000a1d58 0x19cf6ae18)
libc++abi.dylib: terminating with uncaught exception of type NSException

The app keeps running on iOS, but the console log stops after this point, even when new messages arrive.

var app = {
    // Application Constructor
    initialize: function() {
        document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
    },

    // deviceready Event Handler
    //
    // Bind any cordova events here. Common events are:
    // 'pause', 'resume', etc.
    onDeviceReady: function() {
        this.receivedEvent('deviceready');

        FCMPlugin.onNotification(function(data){
            if(data.wasTapped){
              //Notification was received on device tray and tapped by the user.
              alert( JSON.stringify(data) );
            }else{
              //Notification was received in foreground. Maybe the user needs to be notified.
              alert( JSON.stringify(data) );
            }
        });

        FCMPlugin.onFirebaseDataNotificationIOS(
            function(payload) {
              console.info("IOS Message id: "+payload.messageID)
              console.info("IOS Data parameters: "+payload.appData)
            }
          );

        FCMPlugin.getToken(function(token){
            console.log("FCM Token:" + token);
        });
    },

    // Update DOM on a Received Event
    receivedEvent: function(id) {
        var parentElement = document.getElementById(id);
        var listeningElement = parentElement.querySelector('.listening');
        var receivedElement = parentElement.querySelector('.received');

        listeningElement.setAttribute('style', 'display:none;');
        receivedElement.setAttribute('style', 'display:block;');

        console.log('Received Event! ' + id);
    }
};

app.initialize();

After starting the app, it asks for permissions for push notifications, and it outputs a token to the console. Using this token, I send a message with this payload:

{
  "notification":{
    "title":"Notification title",
    "body":"Notification body",
    "sound":"default",
    "click_action":"FCM_PLUGIN_ACTIVITY",
    "icon":"fcm_push_icon"
  },
  "data":{
    "param1":"value1",
    "param2":"value2"
  },
  "to":"fjc...UPj:APA...VyPB",
  "priority":"high",
  "restricted_package_name":"com.example.cordova.test"
}
$ cordova --version
9.0.0 ([email protected])
$ cordova platform ls
Installed platforms:
  android 8.1.0
  browser 6.0.0
  ios 5.1.1
Available platforms:
  electron ^1.0.0
  osx ^5.0.0
  windows ^7.0.0
$ cordova plugins ls
cordova-plugin-fcm-with-dependecy-updated 4.6.2 "Cordova FCM Push Plugin"
cordova-plugin-whitelist 1.3.4 "Whitelist"

Hope I'm missing something obvious here :-) Maybe i'm using a combination of platform/plugin/cordova versions that are incompatible?

How to localize (translate) text on incoming notifications?

Hello.

I was just wondering if there is a clever way to handle multiple languages in our app.

We usually have placeholders for text which then get looked up in a json file related to the current language. Having no control over the native side of the app though, I am not sure how to make this work for the notifications.

Any ideas?

Notification not appear in the top on phone on Android platform when app is background

Hello,
I use FCM to send notification on Android devices. Il work correctly when app is foreground but not when app is background (notification not appear in the top on phone).

In my message payload, I use only data object.
{
"to": "XXXXXXXXXX",
"data": {
"title": "notification_title",
"body": "notification_body"
}
}

I'm using ionic 4 and cordova-android v8.1.0

IOS Build Fails With Error 'Firebase.h' file not found

I am trying to build the ios application via ionic cli by running the following command:

ionic cordova build ios --prod

but the build fails by reporting the following error:

FCMPlugin.m:7:9: fatal error: 'Firebase.h' file not found
#import "Firebase.h"

Here is some information about my environment:

ionic (Ionic CLI) : 4.10.2 (/usr/local/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 5.0.3
@angular-devkit/build-angular : 0.900.3
@angular-devkit/schematics : 9.0.3
@angular/cli : 9.0.3
@ionic/angular-toolkit : 2.2.0

Cordova:
cordova (Cordova CLI) : 8.1.2 ([email protected])
Cordova Platforms : android 8.1.0, browser 6.0.0 ios 5.1.1
Cordova Plugins :
cordova-plugin-fcm-with-dependecy-updated 4.4.0, cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 11 other plugins)

Could you please check and let me know how to overcome this issue?

Support for iOS 9 and WKWebView update

Hi, I need to use this plugin with iOS 9 and WKWebView in order to avoid Apple rejections. I see that the version 5.1.0 solve the WKWebView issue but the iOS 9 support is removed, it doesn't work on ios 9 or there are issues ?

Notification not receiving in foreground on IOS

Thanks for the great plugin and being so responsive to the community,

installed 5.1.0 version of the plugin but below problem still persists in my app

  1. Notification is not displayed in both IOS & Android when app is in Foreground
  2. Notification is displayed in both IOS & Android in Background but only Android onNotification method is invoked but IOS doesn't invokes onNotification even in both foreground and background state

Tried with Legacy build, getting no error when notification is pushed or any breakpoint is getting debugged in Xcode on didReceiveRemoteNotification & didReceiveNotificationResponse method (file : AppDelegate+FCMPlugin.m)

If there are any other plugin in my app causing the notification not getting displayed in foreground app or am I missing something in payload json of notification?

below plugins been used

  • cordova-plugin-badge 0.8.8 "Badge"
  • cordova-plugin-camera 4.0.3 "Camera"
  • cordova-plugin-device 2.0.3 "Device"
  • cordova-plugin-disable-ios11-statusbar 1.0.0 "cordova-plugin-disable-ios11-statusbar"
  • cordova-plugin-fcm-with-dependecy-updated 5.1.0 "Cordova FCM Push Plugin"
  • cordova-plugin-file 6.0.2 "File"
  • cordova-plugin-file-transfer 1.7.1 "File Transfer"
  • cordova-plugin-fingerprint-aio 2.0.0 "FingerprintAllInOne"
  • cordova-plugin-geolocation 4.0.1 "Geolocation"
  • cordova-plugin-googlemaps 2.4.6 "cordova-plugin-googlemaps"
  • cordova-plugin-inappbrowser 4.0.0-dev "InAppBrowser"
  • cordova-plugin-iroot 0.8.1 "iRoot"
  • cordova-plugin-local-notification 0.9.0-beta.2 "LocalNotification"
  • cordova-plugin-network-information 2.0.2 "Network Information"
  • cordova-plugin-privacyscreen 0.3.1 "PrivacyScreenPlugin"
  • cordova-plugin-screen-orientation 3.0.2 "Screen Orientation"
  • cordova-plugin-secure-storage 3.0.2 "SecureStorage"
  • cordova-plugin-splashscreen 5.0.3 "Splashscreen"
  • cordova-plugin-whitelist 1.3.4 "Whitelist"
  • cordova-plugin-wkwebview-engine 1.2.1 "Cordova WKWebView Engine"
  • ionic-plugin-keyboard 2.2.1 "Keyboard"

notification json being pushed from api

{
    "to": "device token",
    "collapse_key": "green",
    "data": {
        "id": 1
    },
    "notification": {
      "title":"Title Message",
      "body":"Notiifcation Message Content",
       "click_action":"FCM_PLUGIN_ACTIVITY"
    }
}

Xcode log of IOS App

W0420 20:29:32.526099       1 commandlineflags.cc:1503] Ignoring RegisterValidateFunction() for flag pointer 0x104eb1490: no flag found at that address
2020-04-20 20:29:32.547953+0530 My App[630:92960] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///private/var/mobile/Containers/Data/Application/D581DC4B-F6EB-4960-BC11-3AC8D00D75AA/Library/Cookies/Cookies.binarycookies
2020-04-20 20:29:32.581190+0530 My App[630:92960] Apache Cordova native platform version 5.1.1 is starting.
2020-04-20 20:29:32.581346+0530 My App[630:92960] Multi-tasking -> Device: YES, App: YES
2020-04-20 20:29:32.668112+0530 My App[630:92960] WF: === Starting WebFilter logging for process My App
2020-04-20 20:29:32.668163+0530 My App[630:92960] WF: _userSettingsForUser mobile: {
    filterBlacklist =     (
    );
    filterWhitelist =     (
    );
    restrictWeb = 1;
    useContentFilter = 0;
    useContentFilterOverrides = 0;
    whitelistEnabled = 0;
}
2020-04-20 20:29:32.668206+0530 My App[630:92960] WF: _WebFilterIsActive returning: NO
2020-04-20 20:29:32.684782+0530 My App[630:92960] WF: _userSettingsForUser mobile: {
    filterBlacklist =     (
    );
    filterWhitelist =     (
    );
    restrictWeb = 1;
    useContentFilter = 0;
    useContentFilterOverrides = 0;
    whitelistEnabled = 0;
}
2020-04-20 20:29:32.684844+0530 My App[630:92960] WF: _WebFilterIsActive returning: NO
2020-04-20 20:29:32.690956+0530 My App[630:92960] WF: _userSettingsForUser mobile: {
    filterBlacklist =     (
    );
    filterWhitelist =     (
    );
    restrictWeb = 1;
    useContentFilter = 0;
    useContentFilterOverrides = 0;
    whitelistEnabled = 0;
}
2020-04-20 20:29:32.691020+0530 My App[630:92960] WF: _WebFilterIsActive returning: NO
2020-04-20 20:29:32.859686+0530 My App[630:92960] CDVWKWebViewEngine will reload WKWebView if required on resume
2020-04-20 20:29:32.859795+0530 My App[630:92960] Using WKWebView
2020-04-20 20:29:32.860240+0530 My App[630:92960] [CDVTimer][console] 0.145078ms
2020-04-20 20:29:32.860390+0530 My App[630:92960] [CDVTimer][handleopenurl] 0.084996ms
2020-04-20 20:29:32.862052+0530 My App[630:92960] Unlimited access to network resources
2020-04-20 20:29:32.862183+0530 My App[630:92960] [CDVTimer][intentandnavigationfilter] 1.745939ms
2020-04-20 20:29:32.862341+0530 My App[630:92960] [CDVTimer][gesturehandler] 0.108004ms
2020-04-20 20:29:32.862504+0530 My App[630:92960] [CDVTimer][disablestatusbar] 0.097036ms
2020-04-20 20:29:32.864486+0530 My App[630:92960] [CDVTimer][file] 1.910090ms
2020-04-20 20:29:32.866986+0530 My App[630:92960] [CDVTimer][cordovagooglemaps] 2.425075ms
2020-04-20 20:29:32.867216+0530 My App[630:92960] [CDVTimer][inappbrowser] 0.111103ms
2020-04-20 20:29:32.867381+0530 My App[630:92960] [CDVTimer][iroot] 0.072956ms
2020-04-20 20:29:32.867540+0530 My App[630:92960] [CDVTimer][privacyscreenplugin] 0.112057ms
2020-04-20 20:29:32.870459+0530 My App[630:92960] [CDVTimer][splashscreen] 2.835989ms
2020-04-20 20:29:32.871432+0530 My App[630:92960] [CDVTimer][keyboard] 0.824094ms
2020-04-20 20:29:32.871536+0530 My App[630:92960] [CDVTimer][TotalPluginStartup] 11.502028ms
2020-04-20 20:29:32.886780+0530 My App[630:92960] DidFinishLaunchingWithOptions
2020-04-20 20:29:32.921485+0530 My App[630:92960] app become active
2020-04-20 20:29:32.941194+0530 My App[630:92960] IAB.close() called but it was already closed.
2020-04-20 20:29:33.144626+0530 My App[630:92960] [ProcessSuspension] 0x106ee1a40 - ProcessAssertion::processAssertionWasInvalidated()
2020-04-20 20:29:33.145263+0530 My App[630:92960] [ProcessSuspension] 0x106ee19e0 - ProcessAssertion::processAssertionWasInvalidated()
2020-04-20 20:29:33.145354+0530 My App[630:92960] [ProcessSuspension] 0x106ee1980 - ProcessAssertion::processAssertionWasInvalidated()
2020-04-20 20:29:33.146315+0530 My App[630:92960] [ProcessSuspension] 0x106ee1aa0 - ProcessAssertion::processAssertionWasInvalidated()
2020-04-20 20:29:33.483563+0530 My App[630:92960] Device FCM Token: fSGC7S-oak81lcqtbYcD4n:APA91bEDpWZxdiORMq1roz-zAFYYSd0fRiy_XuSAlcKq26MaQ5savjfKKmpgM-66Mutop50svKnQ7ILRwrZiRUyh4MZ1KR_38FF7UYvEaPCa7aNR54F04OXoHHwkZoUwhwlwzaoiGNJp
2020-04-20 20:29:33.585463+0530 My App[630:93209] 6.22.0 - [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add `[FIRApp configure];` (`FirebaseApp.configure()` in Swift) to your application initialization. Read more: https://goo.gl/ctyzm8.
2020-04-20 20:29:33.637146+0530 My App[630:93209] 6.22.0 - [Firebase/Analytics][I-ACS031025] Analytics screen reporting is enabled. Call +[FIRAnalytics setScreenName:setScreenClass:] to set the screen name or override the default screen class name. To disable screen reporting, set the flag FirebaseScreenReportingEnabled to NO (boolean) in the Info.plist
2020-04-20 20:29:33.637943+0530 My App[630:93209] 6.22.0 - [Firebase/Analytics][I-ACS800023] No pending snapshot to activate. SDK name: app_measurement
2020-04-20 20:29:33.638454+0530 My App[630:93209] 6.22.0 - [Firebase/Analytics][I-ACS023007] Analytics v.60401000 started
2020-04-20 20:29:33.638931+0530 My App[630:93209] 6.22.0 - [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/RfcP7r)
2020-04-20 20:29:33.639624+0530 My App[630:93209] 6.22.0 - [Firebase/Analytics][I-ACS025036] App Delegate Proxy is disabled
2020-04-20 20:29:34.286644+0530 My App[630:93140] 6.22.0 - [Firebase/Analytics][I-ACS800023] No pending snapshot to activate. SDK name: app_measurement
2020-04-20 20:29:34.620937+0530 My App[630:93140] 6.22.0 - [Firebase/Analytics][I-ACS023012] Analytics collection enabled
2020-04-20 20:29:35.252502+0530 My App[630:92960] Cordova view ready
2020-04-20 20:29:35.363180+0530 My App[630:92960] FCMPlugin.js: is created
2020-04-20 20:29:35.363891+0530 My App[630:92960] FCMPlugin Ready OK
2020-04-20 20:29:35.364356+0530 My App[630:92960] hidePadding android
2020-04-20 20:29:35.364706+0530 My App[630:92960] Ionic Native: deviceready event fired after 1806 ms
2020-04-20 20:29:35.365911+0530 My App[630:92960] {"google":{"maps":{"event":{"MAP_READY":"map_ready","MAP_CLICK":"map_click","MAP_LONG_CLICK":"map_long_click","POI_CLICK":"poi_click","MY_LOCATION_CLICK":"my_location_click","MY_LOCATION_BUTTON_CLICK":"my_location_button_click","INDOOR_BUILDING_FOCUSED":"indoor_building_focused","INDOOR_LEVEL_ACTIVATED":"indoor_level_activated","CAMERA_MOVE_START":"camera_move_start","CAMERA_MOVE":"camera_move","CAMERA_MOVE_END":"camera_move_end","OVERLAY_CLICK":"overlay_click","POLYGON_CLICK":"polygon_click","POLYLINE_CLICK":"polyline_click","CIRCLE_CLICK":"circle_click","GROUND_OVERLAY_CLICK":"groundoverlay_click","INFO_CLICK":"info_click","INFO_LONG_CLICK":"info_long_click","INFO_CLOSE":"info_close","INFO_OPEN":"info_open","MARKER_CLICK":"marker_click","MARKER_DRAG":"marker_drag","MARKER_DRAG_START":"marker_drag_start","MARKER_DRAG_END":"marker_drag_end","MAP_DRAG":"map_drag","MAP_DRAG_START":"map_drag_start","MAP_DRAG_END":"map_drag_end","KML_CLICK":"kml_click","PANORAMA_READY":"panorama_ready","PANORAMA_CAMERA_CHANGE":"panorama_camera_change","PANORAMA_LOCATION_CHANGE":"panorama_location_change","PANORAMA_CLICK":"panorama_click"},"Animation":{"BOUNCE":"BOUNCE","DROP":"DROP"},"Map":{},"StreetView":{"Source":{"DEFAULT":"DEFAULT","OUTDOOR":"OUTDOOR"}},"MapTypeId":{"NORMAL":"MAP_TYPE_NORMAL","ROADMAP":"MAP_TYPE_NORMAL","SATELLITE":"MAP_TYPE_SATELLITE","HYBRID":"MAP_TYPE_HYBRID","TERRAIN":"MAP_TYPE_TERRAIN","NONE":"MAP_TYPE_NONE"},"environment":{},"Geocoder":{},"LocationService":{},"geometry":{"encoding":{},"spherical":{},"poly":{}}}},"notification":{"local":{"core":{"_defaults":{"actionGroupId":null,"actions":[],"attachments":[],"autoClear":true,"badge":null,"channel":null,"color":null,"data":null,"defaults":0,"foreground":false,"group":null,"groupSummary":false,"icon":null,"id":0,"launch":true,"led":true,"lockscreen":true,"mediaSession":null,"number":0,"priority":0,"progressBar":false,"showWhen":true,"silent":false,"smallIcon":"res://icon","sound":true,"sticky":false,"summary":null,"text":"","title":"","trigger":{"type":"calendar"},"vibrate":false,"wakeup":true},"_listener":{}}}}}
2020-04-20 20:29:35.368418+0530 My App[630:92960]  IRoot [object Object]
2020-04-20 20:29:35.374438+0530 My App[630:92960] -canOpenURL: failed for URL: "cydia://package/com.example.package" - error: "This app is not allowed to query for scheme cydia"
2020-04-20 20:29:35.377578+0530 My App[630:92960] -canOpenURL: failed for URL: "cydia://package/com.fake.package" - error: "This app is not allowed to query for scheme cydia"
My App(630,0x10583e040) malloc: can't allocate region
:*** mach_vm_map(size=11846451200, flags: 100) failed (error code=3)
My App(630,0x10583e040) malloc: *** set a breakpoint in malloc_error_break to debug
2020-04-20 20:29:35.378981+0530 My App[630:92960] iOS platform
2020-04-20 20:29:35.379143+0530 My App[630:92960] error JSON.stringify()ing argument: TypeError: JSON.stringify cannot serialize cyclic structures.
2020-04-20 20:29:35.379379+0530 My App[630:92960] file:///private/var/containers/Bundle/Application/89A65B1B-E8C6-42A9-ADFC-267CB24F10F1/My%App.app/www/index.html
2020-04-20 20:29:35.379647+0530 My App[630:92960] dark mode is on
2020-04-20 20:29:35.379832+0530 My App[630:92960] network type wifi
2020-04-20 20:29:35.380013+0530 My App[630:92960] Device is: iPhone8,1
2020-04-20 20:29:35.380272+0530 My App[630:92960] Device UUID is: AAB04DB8-DDE9-4BA6-B3A1-5C44F1FF59B5
2020-04-20 20:29:35.380460+0530 My App[630:92960] app started ...
2020-04-20 20:29:35.380658+0530 My App[630:92960] view registered for notifications
2020-04-20 20:29:35.400064+0530 My App[630:92960] IRoot.isRooted success:  false
2020-04-20 20:29:35.402276+0530 My App[630:92960] -------------------- localstorage did not find 'consectus'
2020-04-20 20:29:35.402655+0530 My App[630:92960] loading dev settings
2020-04-20 20:29:35.403049+0530 My App[630:92960] posting:  /register/registernewcustomer
2020-04-20 20:29:35.403434+0530 My App[630:92960] self.token  false -1587394775397
2020-04-20 20:29:35.403838+0530 My App[630:92960] getting access token
2020-04-20 20:29:35.404324+0530 My App[630:92960] Authorization Code:::::::::::::::
2020-04-20 20:29:35.450771+0530 My App[630:92960] Device FCM Token: dwSTSEilc0ermEDaxTo0mH:APA91bHyfS46aM2EGpGlqFPtNbD-W5mRZPmvaXRcC8lqlEa3cSu_SR1TAkALC-L35bqquB_d5F2wVOUtPgM_g5t0fhig0bKqaqBo3HOWlIumr5lveNUJoo5AYEXMDkyJ_8_ERisQC0OY
2020-04-20 20:29:35.450878+0530 My App[630:92960] notifyFCMTokenRefresh token: dwSTSEilc0ermEDaxTo0mH:APA91bHyfS46aM2EGpGlqFPtNbD-W5mRZPmvaXRcC8lqlEa3cSu_SR1TAkALC-L35bqquB_d5F2wVOUtPgM_g5t0fhig0bKqaqBo3HOWlIumr5lveNUJoo5AYEXMDkyJ_8_ERisQC0OY
2020-04-20 20:29:35.450928+0530 My App[630:92960] stringByEvaluatingJavaScriptFromString FCMPlugin.onTokenRefreshReceived('dwSTSEilc0ermEDaxTo0mH:APA91bHyfS46aM2EGpGlqFPtNbD-W5mRZPmvaXRcC8lqlEa3cSu_SR1TAkALC-L35bqquB_d5F2wVOUtPgM_g5t0fhig0bKqaqBo3HOWlIumr5lveNUJoo5AYEXMDkyJ_8_ERisQC0OY');
2020-04-20 20:29:35.456469+0530 My App[630:92960] refresh token --------------------------- dwSTSEilc0ermEDaxTo0mH:APA91bHyfS46aM2EGpGlqFPtNbD-W5mRZPmvaXRcC8lqlEa3cSu_SR1TAkALC-L35bqquB_d5F2wVOUtPgM_g5t0fhig0bKqaqBo3HOWlIumr5lveNUJoo5AYEXMDkyJ_8_ERisQC0OY
2020-04-20 20:29:36.396084+0530 My App[630:92960] getToken Code XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
2020-04-20 20:29:36.397795+0530 My App[630:92960] self.expires_in 7200000
2020-04-20 20:29:36.398309+0530 My App[630:92960] self.expires_in Mon Apr 20 2020 22:29:36 GMT+0530 (IST)
2020-04-20 20:29:36.825040+0530 My App[630:92960] settings written:
2020-04-20 20:29:37.293250+0530 My App[630:92960] self.isForced storage not ==>
2020-04-20 20:29:37.337291+0530 My App[630:92960] settings written:
2020-04-20 20:29:37.338991+0530 My App[630:92960] saved the status of the maxtouhid
2020-04-20 20:29:37.729461+0530 My App[630:92960] dark mode is on
2020-04-20 20:29:37.804862+0530 My App[630:92960] ionViewDidLoad HintPage
2020-04-20 20:29:37.815682+0530 My App[630:92960] settings written:
2020-04-20 20:29:37.841512+0530 My App[630:92960] ionViewDidLoad HintPage
2020-04-20 20:29:38.463909+0530 My App[630:92960] get Token
2020-04-20 20:29:38.470236+0530 My App[630:92960] >>>>>>>>>>>>>>>> device token found >>>>> dwSTSEilc0ermEDaxTo0mH:APA91bHyfS46aM2EGpGlqFPtNbD-W5mRZPmvaXRcC8lqlEa3cSu_SR1TAkALC-L35bqquB_d5F2wVOUtPgM_g5t0fhig0bKqaqBo3HOWlIumr5lveNUJoo5AYEXMDkyJ_8_ERisQC0OY
2020-04-20 20:29:38.886039+0530 My App[630:92960] register device done [object Object]
2020-04-20 20:29:38.905351+0530 My App[630:92960] settings written:
2020-04-20 20:29:40.304650+0530 My App[630:92960] get Token
2020-04-20 20:29:40.323500+0530 My App[630:92960] >>>>>>>>>>>>>>>> device token found >>>>> dwSTSEilc0ermEDaxTo0mH:APA91bHyfS46aM2EGpGlqFPtNbD-W5mRZPmvaXRcC8lqlEa3cSu_SR1TAkALC-L35bqquB_d5F2wVOUtPgM_g5t0fhig0bKqaqBo3HOWlIumr5lveNUJoo5AYEXMDkyJ_8_ERisQC0OY
2020-04-20 20:29:45.544764+0530 My App[630:92960] app become active
2020-04-20 20:29:45.544938+0530 My App[630:92960] Set state foreground
2020-04-20 20:29:45.589341+0530 My App[630:92960] Device APNS Token: c4bc8150c290930a888526cb8376d5913a61e3cad3e42c61717f3049ca059e7c

Can't get the FCM tokens on iOS

Hi I'm trying to get the FCM tokens on iOS 9 but I get null as FCM token value.

I'm using the 4.6.4 version of this plugin, I'm able to receive the APNS token with this:

FCMPlugin.getAPNSToken(
          function(token) {
            console.log(token);
          },
          function(error) {
            console.error(error);
          }
);

but this return null as token value

FCMPlugin.getToken(function(token){
     console.log(token);
});

and this doesn't get triggered so I can't see the token value 'onTokenRefresh':

FCMPlugin.onTokenRefresh((token) => {
          console.log(token);
});

I'm able to receive push notification if I use the Firebase Cloud Messaging tool to send notification campaign (the tool in the screen below).

Cattura

I need the FCM token for each iOS device because I need to send notifications to specific users.

In Xcode I enabled these capabilities:

  • Background modes => remote notifications
  • Push notifications

In Firebase Cloud Messaging settings I uploaded the Apple APNs Auth Key correctly.

Build Failed after Installing Latest Plugin Version 6.3.1

Hi,
I am using this plugin in my Ionic 5 cordova project and while the plugin install is successfull, I am not able to create a build for iOS. It gives me following error:

ld: library not found for -lFirebaseCore
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any idea what is going on? Thanks.

FCM disable the google plus login on native devices

{
  "name": "nepo",
  "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": "~8.2.14",
    "@angular/core": "~8.2.14",
    "@angular/fire": "^5.4.2",
    "@angular/forms": "~8.2.14",
    "@angular/platform-browser": "~8.2.14",
    "@angular/platform-browser-dynamic": "~8.2.14",
    "@angular/router": "~8.2.14",
    "@ionic-native/core": "^5.0.7",
    "@ionic-native/fcm": "^5.23.0",
    "@ionic-native/google-plus": "^5.23.0",
    "@ionic-native/splash-screen": "^5.0.0",
    "@ionic-native/status-bar": "^5.0.0",
    "@ionic/angular": "^5.0.0",
    "cordova-android": "8.1.0",
    "cordova-plugin-fcm-with-dependecy-updated": "^4.6.3",
    "cordova-plugin-googleplus": "^8.4.0",
    "core-js": "^2.5.4",
    "firebase": "^7.14.0",
    "rxjs": "~6.5.1",
    "tslib": "^1.9.0",
    "zone.js": "~0.9.1"
    
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.803.20",
    "@angular/cli": "~8.3.23",
    "@angular/compiler": "~8.2.14",
    "@angular/compiler-cli": "~8.2.14",
    "@angular/language-service": "~8.2.14",
    "@ionic/angular-toolkit": "^2.1.1",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "^5.0.0",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-ionic-keyboard": "^2.2.0",
    "cordova-plugin-ionic-webview": "^4.2.0",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.15.0",
    "typescript": "~3.4.3"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-fcm-with-dependecy-updated": {},
      "cordova-plugin-googleplus": {
        "REVERSED_CLIENT_ID": "com.googleusercontent.apps.**********-*************"
      },
      "cordova-plugin-whitelist": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {
        "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
      },
      "cordova-plugin-ionic-keyboard": {}
    },
    "platforms": [
      "android"
    ]
  }
}

Notification badge for android and ios

How could I setup badges with my notification ? I have tried to add badge in message payload , but nothing changed . I also tried to use badge plugin to be increased , but fcm.onNotification() method only works if app is opened ? Could you suggest the best way to handle this functionality , please ?

Build Error After Installing Plugin (D8: Program type already present: android.support.v4.app.INotificationSideChannel$Stub)

The issue I seem to be getting is
D8: Program type already present: android.support.v4.app.INotificationSideChannel$Stub

> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: 
  Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
  Program type already present: android.support.v4.app.INotificationSideChannel$Stub

When I do as suggested by @andrehtissot, I get it to build successfully however I am using cordova-plugin-googleplus and that then has issues and fails to work. From my emulator I see the error in logcat as follows:

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/api/Api$zzf;
2020-05-08 16:33:42.236 8397-8522/ W/System.err:     at com.google.android.gms.auth.api.Auth.<clinit>(Unknown Source:0)
2020-05-08 16:33:42.236 8397-8522/ W/System.err:     at nl.xservices.plugins.GooglePlus.buildGoogleApiClient(GooglePlus.java:181)
2020-05-08 16:33:42.237 8397-8522/ W/System.err:     at nl.xservices.plugins.GooglePlus.execute(GooglePlus.java:97)
2020-05-08 16:33:42.237 8397-8522/ W/System.err:     at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:117)
2020-05-08 16:33:42.237 8397-8522/ W/System.err:     at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98)
2020-05-08 16:33:42.237 8397-8522/ W/System.err:     at org.apache.cordova.PluginManager.exec(PluginManager.java:132)
2020-05-08 16:33:42.237 8397-8522/ W/System.err:     at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59)
2020-05-08 16:33:42.237 8397-8522/ W/System.err:     at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)
2020-05-08 16:33:42.237 8397-8522/ W/System.err:     at android.os.MessageQueue.nativePollOnce(Native Method)
2020-05-08 16:33:42.237 8397-8522/ W/System.err:     at android.os.MessageQueue.next(MessageQueue.java:336)
2020-05-08 16:33:42.237 8397-8522/ W/System.err:     at android.os.Looper.loop(Looper.java:174)
2020-05-08 16:33:42.237 8397-8522/ W/System.err:     at android.os.HandlerThread.run(HandlerThread.java:67)
2020-05-08 16:33:42.237 8397-8522/ W/System.err: Caused by: java.lang.ClassNotFoundException: com.google.android.gms.common.api.Api$zzf

My Ionic Info:

Ionic:

   Ionic CLI                     : 6.8.0 (/usr/local/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.0.7
   @angular-devkit/build-angular : 0.803.25
   @angular-devkit/schematics    : 8.3.25
   @angular/cli                  : 8.3.26
   @ionic/angular-toolkit        : 2.2.0

Cordova:

   Cordova CLI       : 9.0.0 ([email protected])
   Cordova Platforms : android 8.1.0, ios 5.1.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 11 other plugins)

Utility:

   cordova-res (update available: 0.14.0) : 0.11.0
   native-run                             : 1.0.0

System:

   Android SDK Tools : 26.1.1 (/Users/user/Library/Android/sdk)
   ios-deploy        : 1.10.0
   ios-sim           : 8.0.2
   NodeJS            : v12.14.1 (/usr/local/bin/node)
   npm               : 6.14.4
   OS                : macOS Catalina
   Xcode             : Xcode 11.4.1 Build version 11E503a

my package.json

"dependencies": {
    "@angular/common": "~8.2.14",
    "@angular/core": "~8.2.14",
    "@angular/fire": "^6.0.0",
    "@angular/forms": "~8.2.14",
    "@angular/platform-browser": "~8.2.14",
    "@angular/platform-browser-dynamic": "~8.2.14",
    "@angular/router": "~8.2.14",
    "@babel/compat-data": "^7.8.0",
    "@ionic-native/core": "^5.0.0",
    "@ionic-native/fcm": "^5.25.0",
    "@ionic-native/google-plus": "^5.23.0",
    "@ionic-native/in-app-browser": "^5.24.0",
    "@ionic-native/photo-viewer": "^5.24.0",
    "@ionic-native/splash-screen": "^5.0.0",
    "@ionic-native/status-bar": "^5.0.0",
    "@ionic/angular": "^5.0.0",
    "com-sarriaroman-photoviewer": "git+https://github.com/TdoubleG/photoviewer.git",
    "cordova-android": "^8.1.0",
    "cordova-ios": "5.1.1",
    "cordova-plugin-fcm-with-dependecy-updated": "^6.3.1",
    "cordova-plugin-googleplus": "^7.0.2",
    "cordova-plugin-inappbrowser": "^3.2.0",
    "cordova-res": "^0.11.0",
    "cordova-support-android-plugin": "^1.0.2",
    "cordova-support-google-services": "^1.4.0",
    "core-js": "^2.5.4",
    "firebase": "^7.13.2",
    "ngx-ionic-image-viewer": "^0.7.0",
    "rxjs": "~6.5.1",
    "tslib": "^1.9.0",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.803.20",
    "@angular/cli": "8.3.26",
    "@angular/compiler": "~8.2.14",
    "@angular/compiler-cli": "~8.2.14",
    "@angular/language-service": "~8.2.14",
    "@ionic/angular-toolkit": "^2.1.1",
    "@ionic/lab": "3.1.3",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "^5.0.0",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-ionic-keyboard": "^2.2.0",
    "cordova-plugin-ionic-webview": "^4.1.3",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "npm-force-resolutions": "0.0.3",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.15.0",
    "typescript": "~3.4.3"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-whitelist": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {
        "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
      },
      "cordova-plugin-ionic-keyboard": {},
      "com-sarriaroman-photoviewer": {},
      "cordova-plugin-googleplus": {
        "PLAY_SERVICES_VERSION": "11.8.0"
      },
      "cordova-plugin-inappbrowser": {},
      "cordova-plugin-fcm-with-dependecy-updated": {
        "FCM_VERSION": "19.0.0",
        "GRADLE_TOOLS_VERSION": "3.5.3",
        "GOOGLE_SERVICES_VERSION": "4.3.3",
        "SUPPORT_LIBRARY_VERSION": "28.0.0",
        "ANDROID_DEFAULT_NOTIFICATION_ICON": "@mipmap/ic_launcher"
      }
    },
    "platforms": [
      "ios",
      "android"
    ]
  }
``` # # # #

Cannot add extension with name 'googleServices', as there is an extension already registered with that name

Facing below exception while using FCM plugin. Any help is appreciated

Configure project :app
FCM PLUGIN GRADLE TOOLS VERSION: 3.5.3Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.

FAILURE: Build failed with an exception.

  • Where:
    Script '/path/to/project/platforms/android/cordova-plugin-fcm-with-dependecy-updated/osn-FCMPlugin.gradle' line: 56

  • What went wrong:
    A problem occurred evaluating script.

Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin']
Cannot add extension with name 'googleServices', as there is an extension already registered with that name.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 1s
/path/to/project/platforms/android/gradlew: Command failed with exit code 1 Error output:
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.

FAILURE: Build failed with an exception.

  • Where:
    Script 'path/to/project/platforms/android/cordova-plugin-fcm-with-dependecy-updated/osn-FCMPlugin.gradle' line: 56

  • What went wrong:
    A problem occurred evaluating script.

Failed to apply plugin [class 'com.google.gms.googleservices.GoogleServicesPlugin']
Cannot add extension with name 'googleServices', as there is an extension already registered with that name.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

IOS build error after adding Firebase Dynamic Links plugin

I've been using this plugin with no problem for a while. Last week I added the Firebase Dynamic Links plugin to my Ionic app and wasn't able to build for Android. It was throwing this error while trying to build:

Dependency failing: com.google.firebase:firebase-messaging:19.0.0 -> com.google.firebase:firebase-iid@[19.0.0], but fire
  base-iid version was 20.0.2.

After some research I found a solution. Adding androidx and androidx-adapter plugins plus changing the version to 20.1+ on the following line

cordova.system.library.9=com.google.firebase:firebase-messaging:18.0

on the project.properties file, this for Android.

But now I'm trying to build for IOS and it's throwing me errors for this plugin again:

The following build commands failed:
	CompileC /Users/user911231/Library/Developer/Xcode/DerivedData/Project-fwezigjjyvjbvcgqjcyweuybexmt/Build/Intermediates.noindex/Project.build/Release-iphonesimulator/Project.build/Objects-normal/x86_64/FCMPlugin.o /Users/user911231/Desktop/Projects/Project/project-mobile/platforms/ios/Project/Plugins/cordova-plugin-fcm-with-dependecy-updated/FCMPlugin.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler

xcodebuild: Command failed with exit code 65

I believe it's conflicting with the recently added plugin since that if I remove dynamic links on both platforms the build is successful. Is there anything I can do similar to what I did above for Android? What could be the reason?

fatal: repository 'https://cdn.cocoapods.org/' not found

I am trying to add this depecndency but getting this exception.

cordova plugin add cordova-plugin-fcm-with-dependecy-updated
Installing "cordova-plugin-fcm-with-dependecy-updated" for ios
Running command: pod install --verbose
Ignoring bcrypt-3.1.11 because its extensions are not built.  Try: gem pristine bcrypt --version 3.1.11

Ignoring byebug-9.0.6 because its extensions are not built.  Try: gem pristine byebug --version 9.0.6

Ignoring json-1.8.3 because its extensions are not built.  Try: gem pristine json --version 1.8.3

Ignoring json-1.8.3 because its extensions are not built.  Try: gem pristine json --version 1.8.3

Ignoring json-1.8.3 because its extensions are not built.  Try: gem pristine json --version 1.8.3

Ignoring json-1.8.3 because its extensions are not built.  Try: gem pristine json --version 1.8.3

Ignoring hitimes-1.2.4 because its extensions are not built.  Try: gem pristine hitimes --version 1.2.4

Ignoring json-1.8.3 because its extensions are not built.  Try: gem pristine json --version 1.8.3

Ignoring nokogiri-1.6.8.1 because its extensions are not built.  Try: gem pristine nokogiri --version 1.6.8.1

Ignoring unf_ext-0.0.7.2 because its extensions are not built.  Try: gem pristine unf_ext --version 0.0.7.2

/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/executable.rb:89: warning: Insecure world writable dir /Users/apple/Library/Android/sdk/build-tools/28.0.2 in PATH, mode 040777

  Cloning into 'cocoapods-'...

  fatal: repository 'https://cdn.cocoapods.org/' not found

Failed to install 'cordova-plugin-fcm-with-dependecy-updated': Error: pod: Command failed with exit code 1 Error output:
Ignoring bcrypt-3.1.11 because its extensions are not built.  Try: gem pristine bcrypt --version 3.1.11
Ignoring byebug-9.0.6 because its extensions are not built.  Try: gem pristine byebug --version 9.0.6
Ignoring json-1.8.3 because its extensions are not built.  Try: gem pristine json --version 1.8.3
Ignoring json-1.8.3 because its extensions are not built.  Try: gem pristine json --version 1.8.3
Ignoring json-1.8.3 because its extensions are not built.  Try: gem pristine json --version 1.8.3
Ignoring json-1.8.3 because its extensions are not built.  Try: gem pristine json --version 1.8.3
Ignoring hitimes-1.2.4 because its extensions are not built.  Try: gem pristine hitimes --version 1.2.4
Ignoring json-1.8.3 because its extensions are not built.  Try: gem pristine json --version 1.8.3
Ignoring nokogiri-1.6.8.1 because its extensions are not built.  Try: gem pristine nokogiri --version 1.6.8.1
Ignoring unf_ext-0.0.7.2 because its extensions are not built.  Try: gem pristine unf_ext --version 0.0.7.2
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/executable.rb:89: warning: Insecure world writable dir /Users/apple/Library/Android/sdk/build-tools/28.0.2 in PATH, mode 040777
  Cloning into 'cocoapods-'...
  fatal: repository 'https://cdn.cocoapods.org/' not found
    at ChildProcess.whenDone (/Users/apple/Projects/xymob/ionic/mts-apps/new-school-app/node_modules/cordova-common/src/superspawn.js:135:23)
    at ChildProcess.emit (events.js:182:13)
    at maybeClose (internal/child_process.js:962:16)
    at Socket.stream.socket.on (internal/child_process.js:381:11)
    at Socket.emit (events.js:182:13)
    at Pipe._handle.close (net.js:606:12)
pod: Command failed with exit code 1 Error output:
Ignoring bcrypt-3.1.11 because its extensions are not built.  Try: gem pristine bcrypt --version 3.1.11
Ignoring byebug-9.0.6 because its extensions are not built.  Try: gem pristine byebug --version 9.0.6
Ignoring json-1.8.3 because its extensions are not built.  Try: gem pristine json --version 1.8.3
Ignoring json-1.8.3 because its extensions are not built.  Try: gem pristine json --version 1.8.3
Ignoring json-1.8.3 because its extensions are not built.  Try: gem pristine json --version 1.8.3
Ignoring json-1.8.3 because its extensions are not built.  Try: gem pristine json --version 1.8.3
Ignoring hitimes-1.2.4 because its extensions are not built.  Try: gem pristine hitimes --version 1.2.4
Ignoring json-1.8.3 because its extensions are not built.  Try: gem pristine json --version 1.8.3
Ignoring nokogiri-1.6.8.1 because its extensions are not built.  Try: gem pristine nokogiri --version 1.6.8.1
Ignoring unf_ext-0.0.7.2 because its extensions are not built.  Try: gem pristine unf_ext --version 0.0.7.2
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/executable.rb:89: warning: Insecure world writable dir /Users/apple/Library/Android/sdk/build-tools/28.0.2 in PATH, mode 040777
  Cloning into 'cocoapods-'...
  fatal: repository 'https://cdn.cocoapods.org/' not found
[ERROR] An error occurred while running subprocess cordova.
        
        cordova plugin add cordova-plugin-fcm-with-dependecy-updated exited with exit code 1.
        
        Re-running this command with the --verbose flag may provide more information.

Incompatibility with background-geolocation

The contemporary use of cordova-plugin-fcm-with-dependecy-updated together with the plugin ionic-native/background-geolocation causes the following error at build time:

platforms\android\app\src\main\java\com\marianhello\bgloc\data\BackgroundActivity.java:20: error: cannot access zzbfm
        confidence = activity.getConfidence();
                             ^
  class file for com.google.android.gms.internal.zzbfm not found
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
:app:compileDebugJavaWithJavac FAILED

FAILURE: Build failed with an exception.

In order to solve that, you will be required to use cordova-android-play-services-gradle-release
(link) plugin.

You can install the plugin by

cordova plugin add cordova-android-play-services-gradle-release --variable play-services-location=15.0.1

and configure it as follows

package.json

      "cordova-plugin-fcm-with-dependecy-updated": {
        "FCM_VERSION": "19.0.0",
        "GRADLE_TOOLS_VERSION": "3.5.3",
        "GOOGLE_SERVICES_VERSION": "4.3.3",
        "SUPPORT_LIBRARY_VERSION": "28.0.0",
        "ANDROID_DEFAULT_NOTIFICATION_ICON": "@mipmap/ic_launcher"
      },
      "cordova-android-play-services-gradle-release": {
        "PLAY-SERVICES-LOCATION": "15.0.1"
      }

config.xml

    <plugin name="cordova-android-play-services-gradle-release" spec="~4.0.0">
        <variable name="PLAY-SERVICES-LOCATION" value="15.0.1" />
    </plugin>

Original post:
https://forum.ionicframework.com/t/getting-apk-build-failure-when-using-ionic-native-push-and-ionic-native-background-geolocation/175419/8

Not working with vue-cli-plugin-cordova

Hello.

I'm having issues when using this plugin with vue-cli-plugin-cordova. Essentially, I have a VueJS project with vue-cli-plugin-cordova added.

The firebase notifications are not being received through the android emulator.

The firebase notifications do work when the project is a cordova project and not a VueJS with a cordova plugin. I double-checked all my configuations between the 2 and they appear to be the same yet one works and the other doesn't.

Just to be clear. Since I have a VueJS with a cordova plugin, there's a src-cordova directory. The cordova-plugin-fcm-with-dependecy-updated plugin was added from the src-cordova directory. I did move the changes in the src-cordova/www/js/index.js to public/js/index.js. I even tried adding the script src="FCMPlugin.js" to the public/index.html. None of these changes generated notifications when emulating android.

I did add alerts to index.js which did appear (part of my troubleshooting). I added "typeof (FCMPlugin) != 'undefined'" which evaluated true. So the plugin is loading despite that FCMPlugin.onNotification never receives a notification.

In all of this effort, I don't know how to determine if that's the case or if there's some other setup/configuration issue that is broken.

I appreciate any help you can offer to resolve this issue.

Notification tappes.

I'm using ionic 4, and using fcm plugin in which i got notifications but when click on the notification ii can't handle this click on notification.

getting weird format of fcm token for ios 13

hello,

i was using the library for fcm notification. i was using

   FcmPlugin.getToken().then((token)=>{
                        console.log("***************token***********");
                        console.log(token);
      });

above function to retrieve the fcm token but it is returning a weird format token. i am using cordova-plugin-fcm-with-dependency-updated version 4.6.0.

{length=32,bytes=0x70da2d4619ff25b1795971057859f90d...7b9e555ebfe8df37}'

can you please help?

The plugin has a typo in the name

The name of the plugin should be
cordova-plugin-fcm-with-dependency-updated

The current name is kind of unprofessional. Should be a really simple change.

Incorrect interface definition in @ionic-native/fcm

As an official ionic repository, it doesn't comply to the current implementation of this plugin, lacking the definition of newer features, like onFirebaseDataNotificationIOS.

For this reason, pull request should be open in @ionic-native/fcm with the definition fixes.

Icon of notification

Hello. How I can configure the icon of notification? What's the format of this file must be? And where it must be located in iOS and Android ionic platform folder?
Can I switch between different icons from my sender service?

Other question: I've tried in android emulator but didn't worked (nothing happens when I send the notification) ... in a real device is working ok. Do you know how this can be?

Thanks

Reintroduce iOS 9 support

As to allow users who still require iOS 9 support to enjoy newer fixes and features, the support should be reintroduced, but taking maintainability in mind, so it doesn't bring the issues of older version with it.

Android Foreground notification not working.

I know the banner doesn't show by default when app is in the foreground but I'm not even getting my standard alert with json stringify data params.

when the app is closed the notification banner comes in but when I tap it no alert happening.
Works fine on ios but not android

I'm using cordova-android v8.0.0

onFirebaseDataNotificationIOS is missing from @ionic-native/fcm

Hi All,
I was struggling with an issue of IOS notification not receiving when app is open (works fine when app is closed)

Thanks for the 4.6.0 update which has new method FCMPlugin.onFirebaseDataNotificationIOS to fix my above issue

I tried implementing the new method by installing your latest version of plugin v4.6.0
and also @ionic-native/fcm version 5.23.0

But i got error of "Property 'onFirebaseDataNotificationIOS' does not exist on type 'FCM'.ts(2339)"
when implementing the method in my app.component.ts

Below is my code snippet from app.component.ts

`import { FCM } from '@ionic-native/fcm';

constructor(
private fcm: FCM,
)

initializeApp() {
this.fcm.onFirebaseDataNotificationIOS(
function (payload) {
console.info("Message id: " + payload.messageID)
console.info("Data parameters: " + payload.appData)
}
);
}`

Kindly help me out if i am doing any mistake

FirebaseMessaging: Notification pending intent canceled

I am not sure how to debug the following:

04-06 16:58:28.907  1999  2781 I ActivityTaskManager: START u0 {act=FCM_PLUGIN_ACTIVITY flg=0x14000000 pkg=<redacted> (has extras)} from uid 10135
04-06 16:58:28.908  9646  9646 E FirebaseMessaging: Notification pending intent canceled

I found this was the issue leading to onNotification not being triggered for me. The rest is working properly (initialization, getToken):

[ng] [console.log]: "FCMPlugin.js: is created"
[ng] [console.log]: "FCMPlugin Ready OK"
[ng] [console.log]: "Ionic Native: deviceready event fired after 2200 ms"
[ng] [console.log]: "registerPushNotificationToken" "<redacted-token>"

notification not working ios 13

hello,
i use fcm it work on android but not working on my ios app
i received notification data on xcode console output but no notification display on my phone

ab9c49d5-7a1c-4de7-b653-a1bf1ee6bbc5

Could not get unknown property 'FCM_CORE_VERSION'

I am getting this error whenever i try to build a release version.

Error: /app/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* Where:
Build file '/app/platforms/android/app/build.gradle' line: 299

* What went wrong:
A problem occurred evaluating project ':app'.
> Could not get unknown property 'FCM_CORE_VERSION' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

package.json

"cordova-plugin-fcm-with-dependecy-updated": {
                "FCM_CORE_VERSION": "16.0.9",
                "FCM_VERSION": "18.0.0",
                "GRADLE_TOOLS_VERSION": "3.5.0",
                "GOOGLE_SERVICES_VERSION": "4.2.0"
            }

Failed to install 'cordova-plugin-fcm-with-dependecy-updated': undefined

Hello,
I have the plugin currently working with android, but while trying to add for ios I get the following error:

CordovaError: Promise rejected with non-error: '/bin/sh: /usr/local/bin/pod: ' +
'/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: ' +
'bad interpreter: No such file or directory\n'
at /usr/local/lib/node_modules/cordova/bin/cordova:29:15
at processTicksAndRejections (internal/process/task_queues.js:89:5)

macOS Catalina - 10.15.1
9.0.0 ([email protected])

Already tried to remove platform, install with and without sudo

Program type already present: android.support.v4.app.INotificationSideChannel$Stub

Originally reported by @samit-s3752136, in #52 (comment)

The issue I seem to be getting is
D8: Program type already present: android.support.v4.app.INotificationSideChannel$Stub

> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: 
  Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
  Program type already present: android.support.v4.app.INotificationSideChannel$Stub

When I do as suggested by @andrehtissot, I get it to build successfully however I am using cordova-plugin-googleplus and that then has issues and fails to work. From my emulator I see the error in logcat as follows:

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/api/Api$zzf;
2020-05-08 16:33:42.236 8397-8522/ W/System.err:     at com.google.android.gms.auth.api.Auth.<clinit>(Unknown Source:0)
2020-05-08 16:33:42.236 8397-8522/ W/System.err:     at nl.xservices.plugins.GooglePlus.buildGoogleApiClient(GooglePlus.java:181)
2020-05-08 16:33:42.237 8397-8522/ W/System.err:     at nl.xservices.plugins.GooglePlus.execute(GooglePlus.java:97)
2020-05-08 16:33:42.237 8397-8522/ W/System.err:     at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:117)
2020-05-08 16:33:42.237 8397-8522/ W/System.err:     at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98)
2020-05-08 16:33:42.237 8397-8522/ W/System.err:     at org.apache.cordova.PluginManager.exec(PluginManager.java:132)
2020-05-08 16:33:42.237 8397-8522/ W/System.err:     at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59)
2020-05-08 16:33:42.237 8397-8522/ W/System.err:     at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)
2020-05-08 16:33:42.237 8397-8522/ W/System.err:     at android.os.MessageQueue.nativePollOnce(Native Method)
2020-05-08 16:33:42.237 8397-8522/ W/System.err:     at android.os.MessageQueue.next(MessageQueue.java:336)
2020-05-08 16:33:42.237 8397-8522/ W/System.err:     at android.os.Looper.loop(Looper.java:174)
2020-05-08 16:33:42.237 8397-8522/ W/System.err:     at android.os.HandlerThread.run(HandlerThread.java:67)
2020-05-08 16:33:42.237 8397-8522/ W/System.err: Caused by: java.lang.ClassNotFoundException: com.google.android.gms.common.api.Api$zzf

My Ionic Info:

Ionic:

   Ionic CLI                     : 6.8.0 (/usr/local/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.0.7
   @angular-devkit/build-angular : 0.803.25
   @angular-devkit/schematics    : 8.3.25
   @angular/cli                  : 8.3.26
   @ionic/angular-toolkit        : 2.2.0

Cordova:

   Cordova CLI       : 9.0.0 ([email protected])
   Cordova Platforms : android 8.1.0, ios 5.1.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 11 other plugins)

Utility:

   cordova-res (update available: 0.14.0) : 0.11.0
   native-run                             : 1.0.0

System:

   Android SDK Tools : 26.1.1 (/Users/user/Library/Android/sdk)
   ios-deploy        : 1.10.0
   ios-sim           : 8.0.2
   NodeJS            : v12.14.1 (/usr/local/bin/node)
   npm               : 6.14.4
   OS                : macOS Catalina
   Xcode             : Xcode 11.4.1 Build version 11E503a

my package.json

"dependencies": {
    "@angular/common": "~8.2.14",
    "@angular/core": "~8.2.14",
    "@angular/fire": "^6.0.0",
    "@angular/forms": "~8.2.14",
    "@angular/platform-browser": "~8.2.14",
    "@angular/platform-browser-dynamic": "~8.2.14",
    "@angular/router": "~8.2.14",
    "@babel/compat-data": "^7.8.0",
    "@ionic-native/core": "^5.0.0",
    "@ionic-native/fcm": "^5.25.0",
    "@ionic-native/google-plus": "^5.23.0",
    "@ionic-native/in-app-browser": "^5.24.0",
    "@ionic-native/photo-viewer": "^5.24.0",
    "@ionic-native/splash-screen": "^5.0.0",
    "@ionic-native/status-bar": "^5.0.0",
    "@ionic/angular": "^5.0.0",
    "com-sarriaroman-photoviewer": "git+https://github.com/TdoubleG/photoviewer.git",
    "cordova-android": "^8.1.0",
    "cordova-ios": "5.1.1",
    "cordova-plugin-fcm-with-dependecy-updated": "^6.3.1",
    "cordova-plugin-googleplus": "^7.0.2",
    "cordova-plugin-inappbrowser": "^3.2.0",
    "cordova-res": "^0.11.0",
    "cordova-support-android-plugin": "^1.0.2",
    "cordova-support-google-services": "^1.4.0",
    "core-js": "^2.5.4",
    "firebase": "^7.13.2",
    "ngx-ionic-image-viewer": "^0.7.0",
    "rxjs": "~6.5.1",
    "tslib": "^1.9.0",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.803.20",
    "@angular/cli": "8.3.26",
    "@angular/compiler": "~8.2.14",
    "@angular/compiler-cli": "~8.2.14",
    "@angular/language-service": "~8.2.14",
    "@ionic/angular-toolkit": "^2.1.1",
    "@ionic/lab": "3.1.3",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "^5.0.0",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-ionic-keyboard": "^2.2.0",
    "cordova-plugin-ionic-webview": "^4.1.3",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "npm-force-resolutions": "0.0.3",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.15.0",
    "typescript": "~3.4.3"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-whitelist": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {
        "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
      },
      "cordova-plugin-ionic-keyboard": {},
      "com-sarriaroman-photoviewer": {},
      "cordova-plugin-googleplus": {
        "PLAY_SERVICES_VERSION": "11.8.0"
      },
      "cordova-plugin-inappbrowser": {},
      "cordova-plugin-fcm-with-dependecy-updated": {
        "FCM_VERSION": "19.0.0",
        "GRADLE_TOOLS_VERSION": "3.5.3",
        "GOOGLE_SERVICES_VERSION": "4.3.3",
        "SUPPORT_LIBRARY_VERSION": "28.0.0",
        "ANDROID_DEFAULT_NOTIFICATION_ICON": "@mipmap/ic_launcher"
      }
    },
    "platforms": [
      "ios",
      "android"
    ]
  }

On Android 6 (Marshmallow), notification crashes app : unable to load icon resource

I've installed the plugin using the option --variable ANDROID_DEFAULT_NOTIFICATION_ICON = "@drawable/fcm_push_icon" to specify the notification icon. That icon is black and white, alpha channel only, created with Android Studio.

On Android 7+, everything works fine, but on Android 6 (Marshmallow) notifications are never displayed, and if the app is in background it crashes upon reception of a notification. Apparently this is due to the system being unable to load the icon resource:

Unable to load resource 0x7f070087 from pkg=com.lonofi.app
android.content.res.Resources$NotFoundException: Resource ID #0x7f070087
...
StatusBarIconView: No icon for slot com.lonofi.app/0x0
NotificationService: onNotification error pkg=com.lonofi.app tag=FCM-Notification:593614 id=0; will crashApplication(uid=10061, pid=6592)
StatusBar: removeNotification for unknown key: 0|com.lonofi.app|0|FCM-Notification:593614|10061
AndroidRuntime: android.app.RemoteServiceException: Bad notification posted from package com.lonofi.app: Couldn't create icon: StatusBarIcon(icon=Icon(typ=RESOURCE pkg=com.lonofi.app id=0x7f070087) visible user=0 )

Any idea how to solve this?

Duplicate resources (string/google_app_id and string/google_api_key) as of v4.4.3

First of all, thank you for all the work maintaining this library! 🎉

Today, my builds started to fail suddenly (only for Android, iOS builds are not affected) due to duplicate resources in the :app:mergeReleaseResources gradle task. When I downgraded to v4.4.1, everything started working again.

I guess this is a regression in the refactoring of the file lookup, but I didn't find the cause while looking through the source code. For now, I downgraded to get my app to build again, but I'd appreciate any help though. 🙂

Duplicate Notification When app in background or closed

When App is foreground I am receiving notification on js callback but not in notification tray which is fine.

But in the background or closed state the same notification is coming twice in Notification tray.
What shall be the reason?

Callbacks on requestPushPermissionIOS not working

Calling
FCMPlugin.requestPushPermissionIOS( successCallback(), errorCallback(err) );
callbacks are never executed.
Seems that method requestPushPermission in FCMPlugin.m is not handling callbacks, am I missing something?
Thanks in advance!

iOs 13 data notification

Hi, and first of all, thanks for this great plugin, the stable version provided, the simple doc, and the all the support.

I would like to have info about iOs 13 data notification, as from some tests and code inspections seems that only Notification message type is working fine, and the Data message notification isn't pratically doing anything on iOs.

I want to be sure that I don't have made any mistake in configuring my scenario.

  1. Installed your plugin.
  2. Configured google services files in root.
  3. Configured APNS by creating a certificate on Apple Developer and setting it in the Firebase Messaging console configuration.
  4. Build and launch the app for registering the plugin, showing the token (only FCM), and listening to notifications (both method, included latest).

(I have the @ionic-native/cordova-plugin-fcm plugin adapter but also modifying it to support the new method, result doesn't change).

    this.fcm.onNotification().subscribe(data => {
      if ( data.wasTapped ) {
        // Notification was received on device tray and tapped by the user.
        console.log( JSON.stringify(data) );
      } else {
        // Notification was received in foreground. Maybe the user needs to be notified.
        console.log( JSON.stringify(data) );
      }
    }, err => {
      this.utils.handleError(err);
    });

    (window as any).FCMPlugin.onFirebaseDataNotificationIOS(
      payload => {
        console.log('Payload: ', payload);
      }
    );

For testing, i'm using my own REST software (postman).
I get the FCM token from the console, and posting it with the correct header and following payload:

{
  "notification":{
    "title": "nope",
    "body": "gggg",
    "sound": "default",
    "click_action": "FCM_PLUGIN_ACTIVITY",
    "icon": "fcm_push_icon"
  },
  "data":{
    "type":"my_data",
    "id": 70000000
  },
    "to": "<my_token>",
    "priority":"high",
    "content_available": true
}

What DOES happens:

  • Android foreground: notification shown + code callback
  • Android background: notification shown + code callback on notification tap
  • iOs foreground: notification shown
  • iOs background: notification shown

What DOESN'T ever happens?

  • iOs foreground: code callback
  • iOs background: code callback

What would I expect:

  • same iOs behavior of Android

Other investigations:

  • I've also tried to change the notification body to remove the whole notification body, making it a real data notification as doc states. In this case NOTHING happens
  • look at AppDelegate+FCMPlugin.m code in the plugin, at the didReceiveRemoteNotification method. There on line 196 we found that the data notification is "being handled by the notification center" (what?) and just interrupt execution
  • I found a patch online: fechanique#349 (comment), and using this, the callback is handled by when iOs app is foreground, but only the notification it's a pure data notification (see before), and to also show a notification (yes, still with app in foreground), we would need to use a sort of cordova-plugin-local-notification
  • Still no way to get the callback executed on iOs background

So, before starting to try to reinvent the wheel, is there something am I missing?

Could you please explain me:

  • What's the purpose of the onNotification method on iOs? (In my case's never called)
  • What's the purpose of the onFirebaseDataNotificationIOS method on iOs? (In my case's never called)
  • What's the purpose of the getAPNSToken method on iOs? (Do I actually need it ever to be able to receive a notification or it's just an utilities for other systems besides FCM?)

Jackie

"hasPermission" is not firing

I get the token as desired, but FCMPlugin.hasPermission() is not firing. I am not getting any popup asking for "Allow Push Notification" in my ionic ios project. Any idea what is going wrong?

Change badge number on push

Thanks for the time & for the reply, yes for the android i am using cordova-plugin-local-notification to show notification on foreground since onNotification is working on android both foreground and background

For iOS, my requirement is at-least update the badge when Notification is been received when app is in foreground state hence onNotification should work

Originally posted by @viksat7 in #54 (comment)

FCM plugin exception - Namespace SPRINGBOARD, Code 0x8badf00d

Facing below exception while using FCM plugin.
This is observed in iOS device only, n every app launch app is crashing.

Incident Identifier: 1467E172-6976-4820-BC8F-EC117C872B1A
CrashReporter Key: c6d17c65815372ba349e2a14fc1fcc9a155742c0
Hardware Model: iPhone8,1
Process: MyAppName [394]
Path: /private/var/containers/Bundle/Application/EC6C615A-938D-4771-8CA5-5B0C7BF58FCA/MyAppName.app/MyAppName
Identifier: MyPackageName
Version: 0.6.2 (0.6.2)
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: MyPackageName [490]

Date/Time: 2020-03-27 17:44:05.4206 +0530
Launch Time: 2020-03-27 17:43:44.7608 +0530
OS Version: iPhone OS 13.3 (17C54)
Release Type: User
Baseband Version: 7.30.02
Report Version: 104

Exception Type: EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: Namespace SPRINGBOARD, Code 0x8badf00d
Termination Description: SPRINGBOARD, scene-create watchdog transgression: application:394 exhausted real (wall clock) time allowance of 19.78 seconds | ProcessVisibility: Foreground | ProcessState: Running | WatchdogEvent: scene-create | WatchdogVisibility: Foreground | WatchdogCPUStatistics: ( | "Elapsed total CPU time (seconds): 20.470 (user 20.470, system 0.000), 51% CPU", | "Elapsed application CPU time (seconds): 0.568, 1% CPU" | )
Triggered by Thread: 0

Thread 0 name: Dispatch queue: com.google.FirebaseInstanceID.Keychain
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x0000000185eb8634 0x185eb5000 + 13876
1 libsystem_kernel.dylib 0x0000000185eb7aa0 0x185eb5000 + 10912
2 libdispatch.dylib 0x0000000185d6a7cc 0x185d53000 + 96204
3 libdispatch.dylib 0x0000000185d6ab94 0x185d53000 + 97172
4 libxpc.dylib 0x0000000185cae440 0x185ca3000 + 46144
5 Security 0x0000000186f0d224 0x186eed000 + 131620
6 Security 0x0000000186f0dc38 0x186eed000 + 134200
7 Security 0x0000000186f8e17c 0x186eed000 + 659836
8 Security 0x0000000186f8d054 0x186eed000 + 655444
9 Security 0x0000000186f8b92c 0x186eed000 + 649516
10 Security 0x0000000186f8c2d4 0x186eed000 + 651988
11 Security 0x0000000186f8e084 0x186eed000 + 659588
12 Security 0x0000000186f89f48 0x186eed000 + 642888
13 Security 0x0000000186f8c6f4 0x186eed000 + 653044

Struggling with this issue since 3 days. PLease help ASAP!!!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.