# Android Push Notifications

**URL:** <https://forums.fusetools.com/t/android-push-notifications/5414>\
**Category:** How-to Discussions\
**Created:** [August 22, 2016, 11:42am UTC](https://forums.fusetools.com/t/android-push-notifications/5414 "2016-08-22T11:42:39Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![remnnis\_scion](https://avatars.discourse-cdn.com/v4/letter/r/a9a28c/32.png) [@remnnis\_scion](https://forums.fusetools.com/u/remnnis_scion)\
**Post date:** [August 22, 2016, 11:42am UTC](https://forums.fusetools.com/t/android-push-notifications/5414/1 "2016-08-22T11:42:39Z")

</div>

Greetings! My name is Richard Makhaya. I’m having some difficulty with android push notifications. Having read the tutorial I made sure to download the google play service as well as android support libraries and updated the .unoproj file to include the “Fuse.PushNotifications” package and addded:

“Android”: {  
“GooglePlay”: {  
“SenderID”: “fuseproject-140513”  
}  
}

where fuseproject-140513 is my project ID from the google developer’s console. I also made sure that the cloud messaging service was enabled. But woe is me… The javascript code to detect push events does not even fire any events. i.e:

var push = require(“FuseJS/Push”);

```
    push.onRegistrationSucceeded = function(regID) {
        registrationMessage = "Reg Succeeded: " + regID;
    };

    push.onRegistrationFailed = function(reason) {
        registrationMessage = "Reg Failed: " + reason;
    };

    push.onReceivedMessage = function(payload) {
        registrationMessage = "Reg Failed: " + reason;
    };

```

Not even the push.onRegistrationFailed event fires. I tried it using the local preview as well as android preview. Is there any place I went wrong?

---

<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:** [August 22, 2016, 11:47am UTC](https://forums.fusetools.com/t/android-push-notifications/5414/2 "2016-08-22T11:47:29Z")

</div>

Hey Bahle,  
one thing you’ve definitely done wrong is the sender ID. You have to find and use the `project number` (11 digits). Reference: [http://stackoverflow.com/questions/11294602/android-gcm-sender-id-how-to-get-it](http://stackoverflow.com/questions/11294602/android-gcm-sender-id-how-to-get-it)

---

<div class="post-metadata">

**Author:** ![remnnis\_scion](https://avatars.discourse-cdn.com/v4/letter/r/a9a28c/32.png) [@remnnis\_scion](https://forums.fusetools.com/u/remnnis_scion)\
**Post date:** [August 22, 2016, 3:12pm UTC](https://forums.fusetools.com/t/android-push-notifications/5414/3 "2016-08-22T15:12:38Z")

</div>

Tried that, I used the project number instead of the project id but it still doesn’t receive any push events.

---

<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:** [August 22, 2016, 4:45pm UTC](https://forums.fusetools.com/t/android-push-notifications/5414/4 "2016-08-22T16:45:23Z")

</div>

Another thing I might suggest based on my experience is - when you launch device preview on Android, close the app by clicking the hardware home button, then reopen it from recent apps screen.

I’m not entirely sure why, but sometimes the app wouldn’t register with GCM upon the first launch, while the second launch usually fires everything just fine.

And if that doesn’t help, try killing the preview from recent apps screen, then restart it from the device again, simply by launching the “App (preview)” application that will have been installed there when you ran the preview.

All of that said, push notifications obviously only work on an actual device.

---

<div class="post-metadata">

**Author:** ![remnnis\_scion](https://avatars.discourse-cdn.com/v4/letter/r/a9a28c/32.png) [@remnnis\_scion](https://forums.fusetools.com/u/remnnis_scion)\
**Post date:** [August 22, 2016, 6:23pm UTC](https://forums.fusetools.com/t/android-push-notifications/5414/5 "2016-08-22T18:23:57Z")

</div>

Alright, I’ll keep trying, no luck so far but I’ll keep updating as to progress made. Thanks a million for the timely assistance 🙂

---

<div class="post-metadata">

**Author:** ![solomun.marko](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@solomun.marko](https://forums.fusetools.com/u/solomun.marko)\
**Post date:** [April 20, 2017, 10:06pm UTC](https://forums.fusetools.com/t/android-push-notifications/5414/6 "2017-04-20T22:06:50Z")

</div>

Hi Uldis,

I am trying to find any reference “How-to” for Push notifications. Can You please give me any example (raw) of files `.ux` and `.unoproj`  
I followed this [https://www.fusetools.com/docs/fuse/pushnotifications/push](https://www.fusetools.com/docs/fuse/pushnotifications/push) but could not make it work. I downloaded one of example apps and tried to implement it into. Here is my `unoproj` file:

```auto
{
  "RootNamespace":"",
  "Packages": [
  	"Fuse",
  	"FuseJS",
    "Fuse.PushNotifications"
  ],

  "Includes": [
    "*",
    "Assets/Authors/*.jpeg:Bundle",
    "Assets/Images/*.jpg:Bundle"
  ],
  "Android": {
    
    "GooglePlay": {
        "SenderID": "1234567891011"
      }
   
  }
}

```

And I just pasted javascript example from [https://www.fusetools.com/docs/fuse/pushnotifications/push](https://www.fusetools.com/docs/fuse/pushnotifications/push) into my `ux` file.  
When I run app on my phone it crashes.  
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:** [April 21, 2017, 8:23am UTC](https://forums.fusetools.com/t/android-push-notifications/5414/7 "2017-04-21T08:23:23Z")

</div>

Hi Solomun,

here is a community package that implements the basic push notification support: [https://github.com/cubissimo/FusePushExample](https://github.com/cubissimo/FusePushExample)

If your app crashes, I suggest you create a new forum thread with all information, including any errors thrown. It may be completely unrelated to push notifications, so it doesn’t fit here in this thread.

---

<div class="post-metadata">

**Author:** ![solomun.marko](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@solomun.marko](https://forums.fusetools.com/u/solomun.marko)\
**Post date:** [April 22, 2017, 8:43pm UTC](https://forums.fusetools.com/t/android-push-notifications/5414/8 "2017-04-22T20:43:03Z")

</div>

Hi Uldis,

That’s it! This works. This is my first app and more important it works. I just need to learn and understand the basics. Thanks.
