3 Replies Latest reply on Mar 4, 2017 12:34 PM by pspg1985

    Firebase FCM - APNs Push Notifications- InternalServerError


      Is there any documentation for configuring iOS push notification for Apps developed on PhoneGap?

      Are there any users currently using cordova firebase or cordova push plugin successfully?


      We are trying to configure PUSH notifications for iOS. We want to push Notifications from OUR server to iOS using Firebase.


      First we took our APNs Registration Token and mapped it successfully to Firebase Registration Token using this api call


      Then when we tried to send a PUSH notification to iOS device using this new Firebase token


      We are receiving an InternalServerError.


      Not sure what's causing this... is anybody else seeing this.

      Could it be because FCM is trying to connect to APNs and timing out?


      P.S: We added the iOS app to the firebase and downloaded the config GoogleService-Info.plist

      Also added the APNs development certificate to the Cloud. on the Apple Developer Portal, also created the APNs Auth Key (.p8 file).

      But we have not included any auth keys or certificate on our server. Wasn't any documentation that we found as to where these need to be added.


      Also, tried adding cordova firebase plugin, the app build fails for both ios and android

      This is understandable: because we have both PUsh plugin and the firebase plugin, there must be a conflict.  Posting the error for reference.


      Execution failed for task ':mergeDebugResources'.

      > /project/res/values/strings.xml: Error: Found item String/google_app_id more than one time


      duplicate symbol _OBJC_METACLASS_$_GtalkSelectiveAck in:

          /tmp/gimlet/%APPID%/project/%APPNAME%/Plugins/phonegap-plugin-push/GCM/Libraries/libGcmLi b.a(GtalkExtensions.pb.o)

          %APPNAME%/Plugins/cordova-plugin-firebase/FirebaseMessaging.framework/FirebaseMessaging(G talkExtensions.pb_3df3b2963f0a00a0a06e6bc7758c4642.o)



      Also posted on Google Groups

        • 1. Re: Firebase FCM - APNs Push Notifications- InternalServerError
          simon.macdonald Adobe Employee

          Hi, I'm actually the maintainer of the phonegap-plugin-push repository. If you are looking to use FCM then I suggest you use the branch  GitHub - phonegap/phonegap-plugin-push at v2.0.x  which has FCM support. Then you can remove the firebase plugin to get rid of any build conflicts.


          The token you will get back from the phonegap-plugin-push register event will be able to be used with FCM. Give that a try and let me know how it goes. If you run into bugs we can raise issues on the plugin's github repo.

          1 person found this helpful
          • 2. Re: Firebase FCM - APNs Push Notifications- InternalServerError
            pspg1985 Level 1

            Hi Simon,

            I looked at the documentation for the phonegap-plugin-push for v2.0.x but I didn't see any method to send notification.

            This is similar to the previous version of the push plugin. I can't test the new version to see if it works or not because, we are able to get registration with the previous just fine.


            Currently, for android, we use the push plugin to get the token and process the notifications when the device receives them.

            The notification is send through FCM restapi URL Firebase Cloud Messaging HTTP Protocol  |  Firebase


            We are unable send the same for iOS.

            The push plugin gave us the APNs registration token then we mapped the APNs registration token to FCM registration token

            using https://iid.googleapis.com/iid/v1:batchImport


            How can we invoke send from the client? I ask this because, maybe this a authentication issue to the APNs server.

            I uploaded my APNs Development certificate to my iOS app on Firebase and downloaded the GoogleService-Info.plist

            But when invoking the send from the server, I'm sure where and how the authentication occurs.


            And "InternalServerError" message is not at all informative.

            How are we to invoke SEND notifications?

            • 3. Re: Firebase FCM - APNs Push Notifications- InternalServerError
              pspg1985 Level 1

              We are able NOW able to successfully send notification

              ok, I realized what we were doing wrong. In testing, we hadn't realized that APNs device token can change over time and we were using and older device token.


              Figured this might be useful for other teams...


              Luckily stumbled upon a forum that mentioned this... link here; Pasted the excerpt below.


              ****************************************************************************************** ***

              The operating system contacts Apple's servers and obtains a device token to uniquely identify the device the application is running on. This device token is used by your server infrastructure to send push notifications. It does this by sending the device token along with the actual push notification to Apple's servers. Apple's servers are in charge of distributing the push notifications to the appropriate devices.

              Note that the device token differs for each application and it can even change over time for the same application. Apple therefore recommends to ask for a device token every time the application is launched and send the device token to your backend to make sure the device token is up to date.


              Thanks for your help!