fechanique / cordova-plugin-fcm

Google FCM Push Notifications Cordova Plugin
623 stars 999 forks source link

Not receiving push notifications #242

Open theunreal opened 7 years ago

theunreal commented 7 years ago

I installed the plugin and configured it, everything works but whenever I send notification from Firebase Console to my app, I don't see any notification on my device. Is there anything I'm missing?

eddie-lu commented 7 years ago

Hi, I'm not sure what you have tried already but these are the steps I followed to get it working on mine. I'm using Ionic though so it might be different.

  1. Create the project on Firebase and download the google-services.json file to the root of your Android folder (same folder as android.xml)
  2. Install the plugin via cordova plugin add cordoba-plugin-fcm
  3. At this stage, you should be able to send a notification to all devices (make sure you select the correct app if you have more than 1).
  4. In your document.ready() function, check FCMPlugin is loaded ok then get token. This should allow you to send to a single device by specifying the token.
    if(typeof FCMPlugin !== "undefined"){
         alert("FCMPlugin is installed correctly");
          FCMPlugin.getToken(function(token){
                    alert(token);           
              }, function(err){
                    alert('error retrieving token: ' + err);
          });
    }
theunreal commented 7 years ago

Hi @eddie-lu ,Thanks, I'm using Ionic 2, for some reasons I followed all these steps and my device don't receive notifications I send from firebase console. No idea why.

eddie-lu commented 7 years ago

I have never used Ionic 2 so I can't help. If the console is showing success status though, then it might be a problem in the onNotification method.

hassanmirza commented 7 years ago

hello,

how to get started using this plugin with ionic framework? i did the following steps but it doesn't work: 1.create new ionic project: ionic start app blank 2.add ios and android platforms: ionic platform add ios/android 3.get app id from confog.xml: widget id="com.ionicframework.mya647383" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" 4.went to firebase and created config files using app id above and put them in app root directory and inside platforms/android and platforms/ios 5.installed this plugin 6.i build the app with ionic build ios/android 7.i run emulator with ionic run ios 8.went to firebase console and send message and nothing show up in the emulator

can someone please explain how to get this plugin to work

lunedam-git commented 7 years ago

@hassanmirza , You cannot receive push notifications in the IOS emulator. You must use an actual device to test this functionality.

NileshSystematix commented 7 years ago

I am also not getting notification in iOS device. Can you please help me the file names which needs to be used for debugging.

jfchatelain commented 7 years ago

Same for me. Works fine with android, but not with IOS. Any updates on this?

ftechiesnitin commented 6 years ago

Same for me too. I have followed all the steps, I am using Ionic 1. I can see push notifications for Android but not for IOS. Does anyone have a solution for this?

danieledolci87 commented 6 years ago

Copi your GoogleService-Info.plist inside platform/ios//resources and inside platform/ios//resources/resources. When build copy this file, the file is corrupted.

Stromwerk commented 6 years ago

I'm also unable to receive notifications on iOS, while Android works fine. Is there an update to this?

tarasau commented 6 years ago

Same problem with push notification on iOS. Android works fine. Looks like google change some their API's and this touch iOS. On tokenRefresh function on iOS I get a response of (null).

fatenHd commented 6 years ago

same here. i am following step by step with https://javebratt.com/ionic-push-notification/