# Push notification with Firebase on iOS

**URL:** <https://forums.fusetools.com/t/push-notification-with-firebase-on-ios/3511>\
**Category:** General\
**Created:** [May 22, 2017, 2:40pm UTC](https://forums.fusetools.com/t/push-notification-with-firebase-on-ios/3511 "2017-05-22T14:40:17Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lucas\_Monteiro](https://avatars.discourse-cdn.com/v4/letter/l/8dc957/32.png) [@Lucas\_Monteiro](https://forums.fusetools.com/u/Lucas_Monteiro)\
**Post date:** [May 22, 2017, 2:40pm UTC](https://forums.fusetools.com/t/push-notification-with-firebase-on-ios/3511/1 "2017-05-22T14:40:17Z")

</div>

Hi, i’m testing push notification and in Android it’s working, But **iOS** is not receiving notification. I implemented the example of the Fuse documentation in link [FuseJS/Push Module (JS)](https://www.fusetools.com/docs/fuse/pushnotifications/push).

I’ve set up the following scenario:

##### 1º - Backend server in node.js

```auto
var fetch = require('node-fetch');

var API_ACCESS_KEY = 'AIzaSyD2nLYa2M.........U6EeIuecpU';
var DEVICE_ID1 = "APA91bHPRRcMA4e_rl-.........WYhFYdwci"; //Android
var DEVICE_ID2 = "7568137cccabf20502ff2.........c8b4c7b285"; //iOS

var msg = {
  method: 'POST',
  headers: {
    'Authorization': 'key=' + API_ACCESS_KEY,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    registration_ids: [DEVICE_ID1, DEVICE_ID2],
    data: {
      notification: {
        alert: {
          title: 'Well would ya look at that!',
          body: 'Hello from some other app'
        }
      },
      payload: JSON.stringify({key1: 'value1', key2: 'value2'})
    }
  })
};

fetch('https://fcm.googleapis.com/fcm/send', msg).then(function(response) {
  console.log(response);
}, function(error) {
  console.error(error);
});

```

##### 2º - Fuse app

In the _ **unoproj** _ I added “Fuse.PushNotifications” in Packages and

```auto
"Android": {
  "Package": "com.apps.pushmonteiro",
  "GooglePlay": {
      "SenderID": "7010.....0844"
  }
},
"iOS": {
  "BundleIdentifier": "com.apps.pushmonteiro",
  "DevelopmentTeam": "5MW....4JY"
}

```

In the _ **MainView.ux** _

```auto
<App>
  <iOS.StatusBarConfig Style="Dark"/>
  <Android.StatusBarConfig Color="#c2cac4"/>

  <ClientPanel>
    <ScrollView>
      <StackPanel ItemSpacing="8">
        <Each Items="{list}">
          <Text Value="{}" TextWrapping="Wrap"/>
        </Each>
      </StackPanel>
    </ScrollView>

    <JavaScript>
      var Observable = require('FuseJS/Observable');
      var list = Observable();
      var push = require("FuseJS/Push");

      push.on("registrationSucceeded", function(regID){
        list.add("Reg Succeeded: " + regID);
      });

      push.on("error", function(reason) {
        list.add("Reg Failed: " + reason);
      });

      push.on("receivedMessage", function(payload) {
        list.add("Recieved Push Notification: " + payload);
      });
      
      module.exports = {
        list:list
      }
    </JavaScript>
  </ClientPanel>
</App>

```

In the _registrationSucceeded_ function you are able to register for both platforms. While running the service node.js is receiving notification on Android, but is not receiving on iOS.

Permissions are enabled, connection with wi-fi is good. When sending a notification through the Firebase Console for iOS also is not working.

##### Version

```auto
Operational system: macOS Sierra version 10.12.5
Fuse version 0.37.0 (build 12978)
Copyright (C) 2017 Fusetools

```

Another detail, when generating the app, need to open the project in Xcode and mark the configuration to allow “Push Notifications”, otherwise it is not registering. I wish I did not control it manually. If possible, please make it work.

 ![Parameter enabled](https://uploaddeimagens.com.br/images/000/925/070/full/VirtualBox_Sierra_22_05_2017_10_57_35.png?1495462008)

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Uldis](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/uldis/32/657_2.png) [@Uldis](https://forums.fusetools.com/u/Uldis)\
**Post date:** [May 22, 2017, 2:59pm UTC](https://forums.fusetools.com/t/push-notification-with-firebase-on-ios/3511/2 "2017-05-22T14:59:49Z")

</div>

Hi Lucas,

there is a bit of a difference in the Google Firebase and Apple APN support. Please take a look at [this repository](https://github.com/fuse-compound/Fuse.APNS) which tells the whole story about limitations and how you can overcome them currently.

---

<div class="post-metadata">

**Author:** ![Lucas\_Monteiro](https://avatars.discourse-cdn.com/v4/letter/l/8dc957/32.png) [@Lucas\_Monteiro](https://forums.fusetools.com/u/Lucas_Monteiro)\
**Post date:** [May 22, 2017, 4:24pm UTC](https://forums.fusetools.com/t/push-notification-with-firebase-on-ios/3511/3 "2017-05-22T16:24:59Z")

</div>

Is it not possible to use the Fuse library to make the push work on both platforms?

---

<div class="post-metadata">

**Author:** ![Kenzo\_Nawa](https://avatars.discourse-cdn.com/v4/letter/k/82dd89/32.png) [@Kenzo\_Nawa](https://forums.fusetools.com/u/Kenzo_Nawa)\
**Post date:** [July 25, 2017, 5:28pm UTC](https://forums.fusetools.com/t/push-notification-with-firebase-on-ios/3511/4 "2017-07-25T17:28:04Z")

</div>

I’m also looking for a simple solution to push on both platforms…

---

<div class="post-metadata">

**Author:** ![Uldis](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/uldis/32/657_2.png) [@Uldis](https://forums.fusetools.com/u/Uldis)\
**Post date:** [July 26, 2017, 8:05am UTC](https://forums.fusetools.com/t/push-notification-with-firebase-on-ios/3511/5 "2017-07-26T08:05:29Z")

</div>

Push notifications are likely never going to be _simple_ on either of the platforms, but there’s [this repo](https://github.com/fuse-compound/FuseExample_Using_APNS_and_Firebase_Together) that shows how you can use Fuse.APNS for iOS & Fuse.Firebase.Notifications together in the same project.

---

<div class="post-metadata">

**Author:** ![zoran.gorgioski](https://avatars.discourse-cdn.com/v4/letter/z/50afbb/32.png) [@zoran.gorgioski](https://forums.fusetools.com/u/zoran.gorgioski)\
**Post date:** [January 31, 2018, 12:04pm UTC](https://forums.fusetools.com/t/push-notification-with-firebase-on-ios/3511/6 "2018-01-31T12:04:07Z")

</div>

The onRegistrationSucceeded and onReceivedMessage events are pretty much clear and works on both platforms. Also, sending push notification works in Android with firebase (I’m using this api [https://fcm.googleapis.com/fcm/send](https://fcm.googleapis.com/fcm/send)).

What about sending push notification with Fuse.APNS ? Is there some example of code for sending push notification in iOS and is it possible to send push notification with Fuse.APNS in iOS via javascript ?

---

<div class="post-metadata">

**Author:** ![Uldis](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/uldis/32/657_2.png) [@Uldis](https://forums.fusetools.com/u/Uldis)\
**Post date:** [January 31, 2018, 1:48pm UTC](https://forums.fusetools.com/t/push-notification-with-firebase-on-ios/3511/7 "2018-01-31T13:48:32Z")

</div>

@Zoran: [the link](https://github.com/fuse-compound/FuseExample_Using_APNS_and_Firebase_Together) shared in the post right above yours includes all the information you need to get push notifications working on both Android and iOS.

---

<div class="post-metadata">

**Author:** ![zoran.gorgioski](https://avatars.discourse-cdn.com/v4/letter/z/50afbb/32.png) [@zoran.gorgioski](https://forums.fusetools.com/u/zoran.gorgioski)\
**Post date:** [January 31, 2018, 2:54pm UTC](https://forums.fusetools.com/t/push-notification-with-firebase-on-ios/3511/8 "2018-01-31T14:54:51Z")

</div>

The link has information for registration and recieveing a push notification, but not for sending a push notification. But I found this [https://github.com/node-apn/node-apn](https://github.com/node-apn/node-apn) It is a nodejs module for sending push notifications in iOS devices. Is it possible to import this and use in my fusetools project (especcialy in my .unoproj file) and how ?

---

<div class="post-metadata">

**Author:** ![Uldis](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/uldis/32/657_2.png) [@Uldis](https://forums.fusetools.com/u/Uldis)\
**Post date:** [January 31, 2018, 3:07pm UTC](https://forums.fusetools.com/t/push-notification-with-firebase-on-ios/3511/9 "2018-01-31T15:07:12Z")

</div>

Oh. I don’t know about that node package, but perhaps [this section in docs](https://www.fusetools.com/docs/fuse/pushnotifications/push#ios-setup) helps?

Normally, you send push notifications from a backend, so there’s little use (aside from just testing) to have the capability to _send_ push notifications from an app.
