Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
2a2b45b
Firebase SDK update to version 4.0.2 and fixes of breaking changes in…
Jun 19, 2017
1017a4d
remove test code
Jun 19, 2017
bb204c6
remove outdated code
Jun 19, 2017
f9c811e
Upgrade Firebase Ios sdk to version 4.1.0
Aug 28, 2017
427d2a2
added nanopb.framework to plugin.xml
Aug 28, 2017
74c238a
Merge pull request #1 from CowboyCode/master
ostownsville Sep 1, 2017
97809ab
Removed 'else if' clause for google-services.json copying
Sep 3, 2017
d9065c6
merged the pull request - https://github.com/fechanique/cordova-plugi…
Sep 3, 2017
5ebf088
replace outdated code (since 4.0.0)
Sep 4, 2017
1f7fd18
added didReceiveMessage and callback - fishing
Sep 4, 2017
bb21e46
Method has to get replaced. just a test
Sep 4, 2017
146af54
reverse changes
Sep 4, 2017
925d597
Merge pull request #2 from chrisjpalmer/master
ostownsville Sep 4, 2017
4c52d2e
Merge pull request #3 from CowboyCode/master
ostownsville Sep 4, 2017
ee2d68a
Major changes which allow the application to recieve notifications on…
Sep 5, 2017
84849f7
refactored the code to reflect the new FIR SDK
Sep 5, 2017
ba407f1
--amend
Sep 5, 2017
05023af
added the wasTapped information back in AND also corrected the getTok…
Sep 5, 2017
6c58287
readded the caching mechanism so that background pushes are sent to j…
Sep 5, 2017
2624c39
minor fix
Sep 5, 2017
d51c342
added the didReceiveNotificationResponse which seems necessary
Sep 5, 2017
3b57bfb
Fixed compiler warning about duplicate category method
Sep 6, 2017
800d7a4
Merge pull request #4 from chrisjpalmer/master
ostownsville Sep 6, 2017
b9c1517
updated comments to reflect findings in iOS 10
Sep 7, 2017
1156eb2
Merge pull request #5 from chrisjpalmer/master
ostownsville Sep 7, 2017
ae45dfd
Upgrade Firebase IOS SDK to 4.1.1
Sep 7, 2017
2c75a6b
Merge pull request #6 from CowboyCode/master
ostownsville Sep 7, 2017
f167741
support for topics and updated the readme
Sep 11, 2017
d5414d1
topic subscription does not work... need to consider this feature.
Sep 11, 2017
a8e14ad
Merge pull request #7 from chrisjpalmer/master
ostownsville Sep 20, 2017
8e0fbc6
IOS SDK upgrade to 4.2.0
Sep 22, 2017
cd6d15e
Merge pull request #11 from CowboyCode/master
ostownsville Sep 22, 2017
0510aaa
removed firebase/Firebase.h
Sep 24, 2017
1c7bb7f
added Firebase/Firebase.h
Sep 24, 2017
c3ef08d
upgraded to 3.0.1
Sep 24, 2017
521e288
Merge pull request #12 from chrisjpalmer/master
ostownsville Sep 26, 2017
6b5467c
Upgrade Firebase IOS SDK to 4.3.0
Oct 12, 2017
0487930
Firebase IOS SDK upgrade to 4.3.0
Oct 12, 2017
755e4cf
reverse to 3.0.0 for now
Oct 12, 2017
2764fd9
Merge pull request #16 from CowboyCode/master
ostownsville Oct 14, 2017
eddcc10
changes to the readme to make this plugin a bit more independant.
Oct 15, 2017
f3c8d7d
removed auto-subscription from android side of plugin
Oct 15, 2017
5d6972e
slight clarification in the readme
Oct 16, 2017
b0ce427
test different google service version
Oct 16, 2017
6250101
test android google service upgrade
Oct 16, 2017
ef2bdca
reverse one change
Oct 16, 2017
0e43267
add line back in
Oct 16, 2017
5a0935b
testing google-service changes
Oct 16, 2017
1f716f9
wont work, but leave it for now
Oct 16, 2017
b391307
fix syntax error
Oct 16, 2017
4a8f67c
Update FCMPlugin.gradle
Oct 16, 2017
9720bef
filled in the authorship of the new plugin
Oct 17, 2017
0817135
Merge pull request #17 from chrisjpalmer/master
Oct 17, 2017
f205339
reverse maven
Oct 18, 2017
753a470
Upgraded to newer version - need to run platform [email protected]
Oct 23, 2017
516abdc
Changed google-play-version to 11.4.2 - additional plugin needed - se…
Oct 23, 2017
b516980
Merge branch 'master' into master
Oct 23, 2017
e857eb2
Merge pull request #24 from CowboyCode/master
Oct 23, 2017
47d0afc
Update README.md
Oct 23, 2017
e367526
Upgrade firebase ios sdk 4.4.0
Oct 23, 2017
3e9e28e
Added Ios ionic information, that the console plugin has to get removed
Oct 23, 2017
61ae59c
reverse
Oct 23, 2017
5d07218
added ionic ios info
Oct 23, 2017
82cdfe2
Merge branch 'master' into master
Oct 23, 2017
444d996
Merge pull request #25 from CowboyCode/master
Oct 23, 2017
e0cdaf4
potential fix for iOS 11.1
Nov 10, 2017
443fbb9
refined and building code
Nov 16, 2017
6e80e09
working in all cases on ios 11
Nov 16, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 22 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
# Google Firebase Cloud Messaging Cordova Push Plugin
> Extremely easy plug&play push notification plugin for Cordova applications with Google Firebase FCM.

>[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VF654BMGUPQTJ)

#### Version 2.1.2 (03/06/2017)
- Tested on Android and iOS using Cordova cli 6.4.0, Cordova android 6.0.0 and Cordova ios 4.3.1
- Available sdk functions: onTokenRefresh, getToken, subscribeToTopic, unsubscribeFromTopic and onNotification
#### Version 3.0.3 (10/11/2017)
- Tested on Android and iOS using Cordova cli 7.0.1, Cordova android 6.2.3 and Cordova ios 4.5.0
- Available sdk functions: getToken(), onTokenRefresh(), subscribeToTopic(), unsubscribeFromTopic(), onNotification()
- 'google-services.json' and 'GoogleService-Info.plist' are added automatically from Cordova project root to platform folders
- Added data payload parameter to check whether the user tapped on the notification or was received while in foreground.
- **Free testing server available for free! https://cordova-plugin-fcm.appspot.com**
- Supports iOS 9, 10 and 11. For lower versions see the original project: https://github.com/fechanique/cordova-plugin-fcm

## Installation
Make sure you have ‘google-services.json’ for Android or ‘GoogleService-Info.plist’ for iOS in your Cordova project root folder. You don´t need to configure anything else in order to have push notification working for both platforms, everything is magic.
```Bash
cordova plugin add cordova-plugin-fcm
cordova plugin add https://github.com/ostownsville/cordova-plugin-fcm.git
```

#### IOS Ionic ####
With the use of [email protected], you need to remove plugin "cordova-plugin-console" that is installed by default when generating a new Ionic project. Now this is in core part of cordova for iOS.

## Android Update 23/10/2017 ##
Due to upgrades, cordova and google-play-store/firebase
For now, another plugin is to install to fix version issues.

And you have to use android version 6.2.3, it wont run with 6.3.0

```Bash
cordova plugin add cordova-google-api-version --variable GOOGLE_API_VERSION=11.4.2
cordova platform add [email protected]
```

#### Firebase configuration files
Expand All @@ -34,8 +45,7 @@ Put the downloaded file 'GoogleService-Info.plist' in the Cordova project root f

## Usage

:warning: It's highly recommended to use REST API to send push notifications because Firebase console does not have all the functionalities. **Pay attention to the payload example in order to use the plugin properly**.
You can also test your notifications with the free testing server: https://cordova-plugin-fcm.appspot.com
:warning: It's highly recommended to use REST API to send push notifications because Firebase console does not have all the functionality. **Pay attention to the payload example in order to use the plugin properly**.

#### Receiving Token Refresh

Expand All @@ -61,7 +71,7 @@ FCMPlugin.getToken(function(token){

```javascript
//FCMPlugin.subscribeToTopic( topic, successCallback(msg), errorCallback(err) );
//All devices are subscribed automatically to 'all' and 'ios' or 'android' topic respectively.
//The plugin does not automatically subscribe to the "all", "ios" OR "android" topics (this differs from the original version).
//Must match the following regular expression: "[a-zA-Z0-9-_.~%]{1,900}".
FCMPlugin.subscribeToTopic('topicExample');
```
Expand Down Expand Up @@ -129,12 +139,13 @@ Send a push notification to a single device or topic.
- 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 applicacion, nothing happens until the notification is tapped.

:warning: Silent notifications (ie. content-available=1) don't work as of yet.

## License
```
The MIT License

Copyright (c) 2017 Felipe Echanique Torres (felipe.echanique in the gmail.com)
Copyright (c) 2017 Christopher Palmer, Oliver Blum ([email protected], olliblum@gmail.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"version": "2.1.2",
"version": "3.0.3",
"name": "cordova-plugin-fcm",
"cordova_name": "Cordova FCM Push Plugin",
"description": "Google Firebase Cloud Messaging Cordova Push Plugin",
"license": "MIT",
"repo": "",
"issue": "",
"author": {
"name": "Felipe Echanique Torres",
"email": "felipe.echanique@gmail.com"
"name": "Christopher Palmer, Oliver Blum",
"email": "[email protected], olliblum@gmail.com"
},
"repository": {
"type": "git",
"url": "https://github.com/fechanique/cordova-plugin-fcm"
"url": "https://github.com/ostownsville/cordova-plugin-fcm"
},
"keywords": [
"ecosystem:cordova",
Expand Down
74 changes: 40 additions & 34 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,35 @@
-->
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
id="cordova-plugin-fcm"
version="2.1.2">
version="3.0.3">
<name>FCMPlugin</name>
<description>Cordova FCM Plugin</description>
<license>Apache 2.0</license>
<keywords>cordova, fcm, push, plugin</keywords>

<info>
Cordova FCM plugin v2.1.2 installed
For more details visit https://github.com/fechanique/cordova-plugin-fcm
Cordova FCM Plugin v3.0.3 installed
For more details visit https://github.com/ostownsville/cordova-plugin-fcm
</info>

<js-module src="www/FCMPlugin.js" name="FCMPlugin">
<clobbers target="FCMPlugin" />
</js-module>

<engines>
<engine name="cordova-android" version=">=4.0.0" />
<engine name="cordova" version=">=7.1.0"/>
<engine name="cordova-android" version=">=6.2.3"/>
<engine name="cordova-ios" version=">=4.4.0"/>
</engines>

<!-- ANDROID CONFIGURATION -->
<platform name="android">
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<activity android:exported="true" android:name="com.gae.scaffolder.plugin.FCMPluginActivity" android:launchMode="singleTop">
<intent-filter>
<action android:name="FCM_PLUGIN_ACTIVITY" />
<intent-filter>
<action android:name="FCM_PLUGIN_ACTIVITY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</intent-filter>
</activity>
<service android:name="com.gae.scaffolder.plugin.MyFirebaseMessagingService">
<intent-filter>
Expand All @@ -64,56 +66,60 @@
<param name="onload" value="true" />
</feature>
</config-file>
<framework src="com.google.firebase:firebase-core:+" />
<framework src="com.google.firebase:firebase-messaging:+" />

<framework src="com.google.firebase:firebase-core:11.4.2" />
<framework src="com.google.firebase:firebase-messaging:11.4.2" />

<framework src="src/android/FCMPlugin.gradle" custom="true" type="gradleReference"/>

<source-file src="src/android/FCMPlugin.java" target-dir="src/com/gae/scaffolder/plugin" />
<source-file src="src/android/MyFirebaseMessagingService.java" target-dir="src/com/gae/scaffolder/plugin" />
<source-file src="src/android/MyFirebaseInstanceIDService.java" target-dir="src/com/gae/scaffolder/plugin" />
<source-file src="src/android/FCMPluginActivity.java" target-dir="src/com/gae/scaffolder/plugin" />
</platform>

<!-- IOS CONFIGURATION -->
<platform name="ios">
<config-file target="config.xml" parent="/*">
<feature name="FCMPlugin">
<param name="ios-package" value="FCMPlugin"/>
</feature>
</config-file>

<!-- ENABLE PUSH CAPABILITY -->
<config-file parent="aps-environment" target="*/Entitlements-Debug.plist">
<string>development</string>
</config-file>
<config-file parent="aps-environment" target="*/Entitlements-Release.plist">
<string>production</string>
</config-file>

<resource-file src="src/ios/GoogleService-Info.plist" target="Resources/GoogleService-Info.plist" />

<header-file src="src/ios/FCMPlugin.h" />
<source-file src="src/ios/FCMPlugin.m" />


<header-file src="src/ios/FCMQueue.h" />
<source-file src="src/ios/FCMQueue.m" />

<header-file src="src/ios/AppDelegate+FCMPlugin.h" />
<source-file src="src/ios/AppDelegate+FCMPlugin.m" />

<!-- FIREBASE COCOA PODS (not for the moment)-->
<!-- <framework src="Firebase/Messaging" type="podspec" spec="~> 0"/> -->

<!-- FIREBASE LIBS -->
<header-file src="src/ios/firebase/Firebase.h" />
<framework src="src/ios/firebase/FirebaseAnalytics.framework" custom="true" />
<framework src="src/ios/firebase/FirebaseCore.framework" custom="true" />
<framework src="src/ios/firebase/FirebaseInstanceID.framework" custom="true" />
<framework src="src/ios/firebase/FirebaseMessaging.framework" custom="true" />
<framework src="src/ios/firebase/GoogleInterchangeUtilities.framework" custom="true" />
<framework src="src/ios/firebase/GoogleIPhoneUtilities.framework" custom="true" />
<framework src="src/ios/firebase/GoogleSymbolUtilities.framework" custom="true" />
<framework src="src/ios/firebase/GoogleUtilities.framework" custom="true" />

<header-file src="src/ios/Firebase/Firebase.h" />
<framework src="src/ios/Firebase/Analytics/FirebaseAnalytics.framework" custom="true" />
<framework src="src/ios/Firebase/Analytics/FirebaseCore.framework" custom="true" />
<framework src="src/ios/Firebase/Analytics/FirebaseCoreDiagnostics.framework" custom="true" />
<framework src="src/ios/Firebase/Analytics/FirebaseInstanceID.framework" custom="true" />
<framework src="src/ios/Firebase/Analytics/FirebaseNanoPB.framework" custom="true" />
<framework src="src/ios/Firebase/Analytics/GoogleToolboxForMac.framework" custom="true" />
<framework src="src/ios/Firebase/Analytics/nanopb.framework" custom="true" />
<framework src="src/ios/Firebase/Messaging/FirebaseMessaging.framework" custom="true" />
<framework src="src/ios/Firebase/Messaging/Protobuf.framework" custom="true" />

<!-- OTHER NEEDED LIBS -->
<framework src="libc++.tbd" />
<framework src="libz.tbd" />
Expand All @@ -122,9 +128,9 @@
<framework src="libz.tbd" />
<framework src="Security.framework" />
</platform>

<!-- COPY FCM CONFIG FILES TO PLATFORM AFTER PLUGIN INSTALL OR PLATFORM PREPARE -->
<hook src="scripts/fcm_config_files_process.js" type="after_plugin_add" />
<hook src="scripts/fcm_config_files_process.js" type="after_prepare" />

</plugin>
Loading