[Plugins] We've added push notifications to Build.

  • 1
  • Announcement
  • Updated 5 years ago
Here is some more information :)

https://build.phonegap.com/blog/intro...

If you have any issues with it let us know and we'll be happy to help!

Hardeep Shoker
Photo of Hardeep Shoker

Hardeep Shoker

  • 1941 Posts
  • 89 Reply Likes

Posted 8 years ago

  • 1
Photo of Markus Hofer

Markus Hofer

  • 12 Posts
  • 0 Reply Likes
@Phonegap Build Team: We are using the GenericPush Plugin for some time now on iOS and Android with version 2.3.0. I included a reference to the plugin in config.xml* but did NOT upload the PushNotification.js** within the www/ folder.

Recently I compiled the same app with PG 2.7.0 and the push was not working anymore (everything else unchanged). Then I started also including PushNotification.js within the www/ folder in the upload .zip and suddendly it worked.

Do you have any explanation on this? Is Build not including its own PushNotification.js in the 2.7.0 build process anymore, or is it any other reason?

I have to say that I am a bit worried on the instability of the Build system right now, as problems also occured with splash screens after the update from PG 2.3.0 to 2.5.0.

* [gap:plugin name="GenericPush" /]
** https://github.com/phonegap-build/Pus...
Photo of Bob Easterday

Bob Easterday

  • 174 Posts
  • 14 Reply Likes
Hi Markus,
You should not need to explicitly include PushNotification.js in your zip. Build injects that file based on your inclusion of GenericPush. I just verified this on both iOS and Android. I'm not sure why that is failing for you.

Please upload a zip without your own copy of PushNotification.js, and then let me know the app ID. I'll then look on the server and try to figure out what's going on.

The splash screen changes were due to a new requirement by Apple for submissions to the App store. read all about it at https://build.phonegap.com/blog/new-a...
Photo of Markus Hofer

Markus Hofer

  • 12 Posts
  • 0 Reply Likes
Hi Bob. Thanks for your reply.
I just compiled app 377638 following your guidance, and now - out of the sudden - it seems to work.
I know this may read weird, but this is exactly one example of how frustrated I sometimes get with your service. I am 100% sure it did not work 2 days ago, and now it does. Anyway, good it is working now.
Concerning the splash screen, I certainly know why you implemented the changes. Here again, after updating to 2.5.0 from 2.3.0 and following all the new rules on defining the splash images in config.xml, the splash screen would not disappear on the ipad 3 and I could not solve the problem reliably.
Once 2.7.0 got released I compiled the same app with it instead of 2.5.0 and the screen would just disappear. Without any changes to the setup.
Hence my feeling that PG Build is unrealiable.
But maybe I AM doing things wrong. If so, PG Build is the only service I have problems with following the guidelines.
Photo of Oscar Abilleira Muñiz

Oscar Abilleira Muñiz

  • 157 Posts
  • 5 Reply Likes
I have problems using genericPush pluging under version 2.7.0 version in android... in previous versions the pluging works fine, but with this version the notifications are not recieved in a high number of cases in android devices.

The fact is that after launch the app the push notifications are recieved normally, but after some time of inactivity the push notifications are not recieved anymore until you open the app again.

Using 2.5.0 version there's no problem... has anyone this problem problem??

My app number is 167401
Photo of Oscar Abilleira Muñiz

Oscar Abilleira Muñiz

  • 157 Posts
  • 5 Reply Likes
There's no problem it was just problem in my own code... sorry :(
Photo of Juan Fco. Tamaral

Juan Fco. Tamaral

  • 3 Posts
  • 0 Reply Likes
Hi PhoneGap Build Team.

I have problems with plugin 'GenericPush'. I get a notification but I don't open it. Upon receiving a new notification, it replaces that was, instead of keeping 2.

I found the following thread in a forum: http://stackoverflow.com/questions/14...

I think what I have to do to solve it is to set the ID method 'notify ()'.

Is this true? I can configure this from GenericPush?

Thanks.
Photo of Juan Fco. Tamaral

Juan Fco. Tamaral

  • 3 Posts
  • 0 Reply Likes
Does everyone out there using "GenericPush" will happen it? Or am I just the only one?

I need help, any help! Thanks
Photo of ryan pasley

ryan pasley

  • 1 Post
  • 0 Reply Likes
I tried to test this using the sample code from :

https://github.com/hollyschinsky/Phon...

changed the GCM id in the index.js, added to build. When I open in my android i get the error : class not found?

any ideas?

build No: 423994
Photo of Ryan Stewart

Ryan Stewart

  • 35 Posts
  • 2 Reply Likes
Hey Ryan,

Which version of Cordova are you compiling against? It looks like that sample was intended for Cordova 2.2.0 but PhoneGap Build supports 2.7.0.

It also looks like you might need to change the

<gap:plugin name="PushPlugin"/>

to:

<gap:plugin name="GenericPush" /> <!-- latest release -->

based on this list [1]

=Ryan
ryan@adobe.com

[1] https://build.phonegap.com/docs/plugins
Photo of Silverback IS

Silverback IS

  • 21 Posts
  • 0 Reply Likes
I'm getting this error:
"plugman --platform www --project /tmp/gimlet/8cb18fde-d4ea-11e2-9c7c-22000a98b3d6/app/dist --plugin /home/ec2-user/gimlet/vendor/hydration/plugins/GenericPush/1.3.2": sh: line 7: plugman: command not found

I have been trying to play around with the push notification code which I think is what caused this, but reverting back to what worked on 2.5 hasn't cleared the issue. This error means the PGB isn't recognising 'plugman' and a command if I'm not mistaken, so what can I do that would cause plugman to no longer be defined?

App ID: 437556

I'd really appreciate any help, it's driving me mad! Thanks.
Photo of Silverback IS

Silverback IS

  • 21 Posts
  • 0 Reply Likes
Hello, I'd like to add that the issue is only happening now with hydration or debugging enabled. I have turned it off for the time being to test.
Photo of Silverback IS

Silverback IS

  • 21 Posts
  • 0 Reply Likes
With hydration disabled they seemed to build OK, but build does not seem to be linking in the pushnotification.js file because my push-custom.js file is returning an error stating the window.plugins.push... variable is undefined.

I'm unsure about what changes have been made with the new plugman system, is there an overview anywhere because of course there is the rule about not neededing to include your own pushnotification.js file.

I'm not 100% sure anymore about the plugin.xml file location...I seem to change things to test, it doesn't cause errors but doesn't work, put it back and then I can't get to that successful build again...I'd appreciate even if someone isn't having the same issues, but to note down any changes they made to get the genericpush plugin working in 2.7.0 within the last 5 days.
Photo of Ryan Stewart

Ryan Stewart

  • 35 Posts
  • 2 Reply Likes
Hey Silverback,

Could it be a case sensitive error? It looks like pushnotification.js needs to be

<script src="PushNotification.js"></script>

Could that be it?

=Ryan
ryan@adobe.com
Photo of Silverback IS

Silverback IS

  • 21 Posts
  • 0 Reply Likes
I think have referenced everything with the correct capitalisation, just not in my comment above, sorry about that. But also I thought with this new plugman system it shouldn't include the file in that way...?

However...it led me to see that I still had my old PushNotification.js file in the www folder even thought I was not referencing it. The errors immediately went away and everything built successfully.

This line:
pushNotification = window.plugins.pushNotification;

in the javascript now returns 'undefined' is not an object, which seems to me like the PushNotification.js file may be different now, I just don't understand why if the plugin is successfully added to the app how that error could happen. Perhaps when I get back on this again later I'll try to add the PushNotification.js file manually but with a different name as a temp. work-around and see what that does.

I have just tried putting that line back in the head of my document thikning that the page may load in the PushNotification.js file but not add the necessary script in the document head (like including phonegap.js) - that didn't work either.
Photo of srknc

srknc

  • 8 Posts
  • 0 Reply Likes
i'm sending same post to this topic.

config.xml

code
var pushNotification;
pushNotification = window.plugins.pushNotification;
pushNotification.register(push_ios_tokenHandler, push_ios_errorHandler, {"badge":"true","sound":"true","alert":"true","ecb":"onNotificationAPN"});

And push notification function is not working
app id: 316822
Photo of Hyginus Ugwumba

Hyginus Ugwumba

  • 1206 Posts
  • 42 Reply Likes
Hi Srknc,

Delete the pushNotification.js file from your app file and build again. currently build injects this file into the app during build.

For now, this could be the only reason why your app breaks.

Let me know how it goes

Thanks
Hyginus
Photo of srknc

srknc

  • 8 Posts
  • 0 Reply Likes
Hi Hyginus,
There is no pushNotification.js file in my zip file.
Photo of srknc

srknc

  • 8 Posts
  • 0 Reply Likes
Hi Hyginus,
I'm not using GA plugin.
Photo of Silverback IS

Silverback IS

  • 21 Posts
  • 0 Reply Likes
I started a new post as requested in this topic, posted a link and my issues and my comment. The request for me to start a new post has been removed and so has my post: please take a look here:
http://community.phonegap.com/nitobi/...

The issues are not resolved and I have no response - considering the initial problem with plugman was such a big issue that cost so much time for myself using the build system, I'd appreciate confirmation if the systems are working 100%, and otherwise why when I try to push on iPhone the window.plugins variable is undefined and on android it appears to be successful but is not. Could someone please give any advice into this issue for me please. THanks.
Photo of Oscar Abilleira Muñiz

Oscar Abilleira Muñiz

  • 157 Posts
  • 5 Reply Likes
I have built my app using 2.0.7 version of phonegap and build service and under ios the icon is not showing at the status bar, phonegap logo apear in its place.

My id is 167401

The config file is the same that in previous versions have I to change something in my app.
Photo of Bob Easterday

Bob Easterday

  • 174 Posts
  • 14 Reply Likes
Are you referring to the icon that appears in the pull-down notification panel when you receive a notification?
Photo of Oscar Abilleira Muñiz

Oscar Abilleira Muñiz

  • 157 Posts
  • 5 Reply Likes
Yes I'm refering to the thevicon in the pull down notification panel.
Photo of Bob Easterday

Bob Easterday

  • 174 Posts
  • 14 Reply Likes
In your config.xml you reference the main icon file as follows

< icon src="icons/ios/classic.png" gap:platform="ios" width="57" height="57" />

However, in your icons/ios/ folder you have named the file clasic.png (note the misspelling)

If you rename that file to classic.png to match your config.xml entry, this should resolve your problem.
Photo of Oscar Abilleira Muñiz

Oscar Abilleira Muñiz

  • 157 Posts
  • 5 Reply Likes
Yes, that was the problem (really a stupid error hehe) thanks for help ;)
Photo of Anton Suprunov

Anton Suprunov

  • 6 Posts
  • 0 Reply Likes
Hi, I'm trying to incorporate pushPlugin into my apps,

I built a test app from Holly Schinsky's blog post
https://github.com/hollyschinsky/Phon...

updates made to it: PhoneGap 2.7.0, GenericPush as a plugin name, pushNotification.js file was removed from www folder

app id is : 446481

It's an Android specific problem,
so there is just no callbacks are fired for pushNotification.register.
Plugin exist and not equal to undefined,
simply nothing happens after register function called.

tested on real device 4.0 and in emulator 4.0.3, 4.2.2, 4.1.2
Photo of Anton Suprunov

Anton Suprunov

  • 6 Posts
  • 0 Reply Likes
I've built another test app using sample code from generic push plugin on github. I still can't get any reaction from register method.

Here's this app:
https://build.phonegap.com/apps/45391...

built over PhoneGap 2.9.0 with a vaild Google sender ID.

Can someone pleas point at what am I doing wrong?
Photo of Anton Suprunov

Anton Suprunov

  • 6 Posts
  • 0 Reply Likes
figured it out, just in case anyone is experiencing the same problem..register id is returned in "ecb" callback, not in the "success" callback!
Photo of Eric Chauty

Eric Chauty

  • 1 Post
  • 0 Reply Likes
Hi Anton, your app seems to be working. I did not succeed to make the example working :-( So can you share to me your entire code? Thanks for helping me.
Photo of gkatz

gkatz

  • 186 Posts
  • 5 Reply Likes
how many phonegap apps use the push plugin?
is it already widely deployed and field proven?
thanks.
Photo of Usman Sabir

Usman Sabir

  • 10 Posts
  • 0 Reply Likes
This reply was created from a merged topic originally titled
generic push don't always works.


hi,
my build app id 412575
app using generic push plugin. on build/install, ios push notification don't always works. some times it appears in iphone notification list and receive notifications and some times can't get it listed in notification center in iphone/ipad.
on building again and again and installing, some time it works i.e get listed in notif center and get notifications...
what may be wrong with it...

Thanks in advance
Photo of Anders Smedman

Anders Smedman

  • 2 Posts
  • 0 Reply Likes
I am completly new to apps and pushes. I have built from Holly demo push app and replaced senderId and pluginname to "GenericPush". The app starts and I get an alert showing me the regid. No message displays on phone using PushWoosh, I tried everything but I guess I missed something.

the senderId in index.js is the the Id from code.google.com where I also created a Android API key and this key I pasted into the Android config in PushWoosh. Is this correct understood by me?
Photo of Anders Smedman

Anders Smedman

  • 2 Posts
  • 0 Reply Likes
Amazing that 0 samples/demo code mention anything about you have to add and download pushwoosh.js for using their service, which I believe is a good entry for pushine notifications. Case solved, app working and recieves pushed content from pushwoosh.
Photo of Kris Cuvelier

Kris Cuvelier

  • 6 Posts
  • 0 Reply Likes
I currently trying to run my first phonegap app, but I'm having some issues.
This is my code:

https://github.com/MWBKris/testing

After I build this code with Phonegap and downloaded the Android package.
I successfully installed the app but when I try to run this on an Android device I've got an error with the following description: "cannot read property 'pushNotification' of undefined"

You can download the package here:
https://build.phonegap.com/apps/46150...

Thanks in advance
Photo of Hyginus Ugwumba

Hyginus Ugwumba

  • 1206 Posts
  • 42 Reply Likes
Hi kindly open a new thread for this case, I will look into it.

Thanks
Hyginus
Photo of Kris Cuvelier

Kris Cuvelier

  • 6 Posts
  • 0 Reply Likes
Hi,
Sorry, I've made a new thread for this case,
Thanks in advance
Kris
Photo of Daniel Roizman

Daniel Roizman

  • 10 Posts
  • 0 Reply Likes
I'm having a problem with Android receiving background notifications using phonegap 3.0 and :

When the app is in the foreground, it all works fine. When I put the app into background by tapping the Home button, receiving a push notification results in:
'Unfortunately, >AppName< has stopped.

Testing this on Nexus running 4.2.2
Photo of chinmoy basak

chinmoy basak

  • 3 Posts
  • 0 Reply Likes
Hi Hardeep,
I am using phonegap 2.9 for android the problem is My push notification behave differently in two different Android version.In 4.1.2 it open the app but the app crashed but in the 4.4.2 app the push notification is not open the app at all.

I spend hours to solve the problem but still didn't get any result.....
Photo of Woo Choy Man

Woo Choy Man

  • 5 Posts
  • 0 Reply Likes
Hi, it may be late for me to join this conversation. Currently i developing push notification following the examples in github phonegap-build/PushPlugin and phonegap/phonegap-plugin-push . The first example can run in the emulator but cannot run in device after convert to apk. While the second example totally cannot run in bith emulator and device. I had working on it for one week but yet figure out what is problem, .When it run in the device, an alert prompt out and state "Class cannot found". Anyone can guide me to solve this problem?