phonegap-parse-plugin
phonegap-parse-plugin copied to clipboard
On Notification Event?
I was able to easily get push notifications on my device with this plugin, but is there a way to get the message from the push notification in the app? In other words, is there an event that is triggered when a notification is received or when the app is opened from a notification?
For example: if I send the notification that says "Hello", it will show up in the notification drawer and it will say "Hello", but when I open it, the app does nothing. I would like to show a popup alert with the message "Hello" when the app is opened via the notification.
Hi
I tried to add this plug in, but unfortunately not able to make it work .
Thanks R
rajaveernapu, it might be more appropriate for you to start a new issue and then please provide more information. You should explain what you did, what you expected, and what happened instead. So you should probably explain the process you went through in order to add the plugin, and any code that you used.
Hi aharris,
Thank you. I have alreay opened the new issue https://github.com/avivais/phonegap-parse-plugin/issues/9
I have created the new app installed the plugin in deviceready event i have added the
parsePlugin.initialize(PARSEAPPID, PARSECLIENTKEY, function() { alert('success'); }, function(e) { alert('error' + e); });
and in config.xml , added following lines
<plugin name="parsePlugin" value="org.apache.cordova.core.parseplugin"/>
<gap:plugin name="phonegap-parse-plugin" />
If i can get the success, then i can subscribe for the channels
So can you please help me out here
Am i missing any thing here
Thanks R
Hi @aharris88 I think you may have a look at this: Phonegap-Plugins-ParsePushNotifications . It has a onTrigger
event(this line) in the code so you can listen on it, and then decide what to do with it, like open a new page or something like that.
The only problem is that it has no documentation at all, and the code style is not really good, which is also the reason why I find this one.
I'd more than happy to see this repo to add the same functionality, so that I can have control of the notification.
cc/ @avivais
+1 for idea.
Can someone of developer answer? I think even copying code from project that @fraserxu had said is a good solution.
this would be awesome.
@aharris88 Have you found out any answer for your question? I am developing chat application in Phonegap using Parse and I need to get the content of Push notification in order to refresh User's chat contents. Now if I can't access the payload of Push Notification, I will have to leave Parse alltogether and setup my own database and server to handle Push notification. Any thoughts?
+1 for this as well
+1
I noticed that there are a few forks that implement the on notification,
https://github.com/taivo/parse-push-plugin https://github.com/nickh364/phonegap-parse-plugin
and also a few that have updated only the ios, or android side of it respectively
https://github.com/cookys/parse-push-plugin https://github.com/4ndywilliamson/Parse-Push-Plugin-Android
Not sure which ones are more stable, the docs have not been updated on most of them.
Does anyone have a suggestion on which ones are more stable?
@mypark
I tried taivo and it caused some errors, didn't work at all.
Tried cookys and it works really nicely with Android so far, registers perfectly and lets me display notifications in the app. Gonna keep testing on iOS.
OK let me correct myself. cookys works really well on Android except for 1 issue: when opening the app from a push notification, the app hangs. I can't pinpoint the issue but I'll try to figure it out tomorrow :(
@Montoya If there is some message about 'You must call Parse.initialize first' then I would suggest you check out this implementation. It sounds like we are coming from opposite ends. With that one i can resume the app from notification and there's no crash or hang (only tested on Android so far). However, it doesn't hand in any data from the notification to access in javascript. https://github.com/jarseneault/phonegap-parse-plugin/tree/ldr
Well I went back to this repo (avivais) and I'm in the same place now, notifications don't crash or hang the app but nothing is passed to JS. Which is fine for now I guess. I realize most apps don't display push notifications in the app, but it would have been nice to be able to get custom data from push notifications. Anyway, there's got to be a hundred repos of this plugin that all seem to do something slightly different but the documentation is either not updated at all or poorly written, so it's really a mess to go through them. I'm giving up before I lose any more sleep =/
@Montoya you can check out my fork of cooksys, where I fixed a few of the iOS bugs you mentioned... https://github.com/mypark/parse-push-plugin
I also backported to the deprecated initialize instead of pluginInitialize since I'm using ionic instead of the latest cordova.
Dang I wish I had found your fork sooner! Will try it soon, thanks!
haven't updated the docs and haven't been testing/maintaining it but there are somethings that you have to do in your ios code itself, like Parse.initialize - so I'm not sure if that's adequately stated in the docs ... anyways, at least some of the commits can save you some time in the errors I ran into
https://github.com/mypark/parse-push-plugin forked from https://github.com/cookys/parse-push-plugin forked from https://github.com/taivo/parse-push-plugin forked from https://github.com/benjie/phonegap-parse-plugin forked from https://github.com/hyliker/phonegap-parse-plugin forked from https://github.com/xydudu/phonegap-parse-plugin forked from https://github.com/avivais/phonegap-parse-plugin (which is this repository)
Why? What is going on? What should I use?? Can some one merge fixes all the way back here? Thanks!
I merge all the open PRs
Avi Vaisenberger Co-Founder & CTO Fabula Gaming http://www.fabulagame.com +972-50-766-6550
On Mon, Mar 16, 2015 at 11:07 AM, sunshineo [email protected] wrote:
https://github.com/mypark/parse-push-plugin forked from https://github.com/cookys/parse-push-plugin forked from https://github.com/taivo/parse-push-plugin forked from https://github.com/benjie/phonegap-parse-plugin forked from https://github.com/hyliker/phonegap-parse-plugin forked from https://github.com/xydudu/phonegap-parse-plugin forked from https://github.com/avivais/phonegap-parse-plugin (which is this repository)
Why? What is going on? What should I use?? Can some one merge fixes all the way back here? Thanks!
— Reply to this email directly or view it on GitHub https://github.com/avivais/phonegap-parse-plugin/issues/8#issuecomment-81518426 .
@sunshineo all the implementations are very different at this point. I would recommend trying mypark's fork, otherwise stick with this one. most of the other ones are broken in one way or another.
Hey @mypark , could you help me? What's the function that I use in Javascript to receive the notification when the app is running and display it? The documentation says "onNotification(pnObj)" but that's not working for me.
OK @mypark help me understand here... your plugin lets push notifications deep link into the app by implementing openURL but it removes the functionality that allows basic text push notifications to be displayed in the app... ? So if a push is received while the app is running, nothing happens...?
Also I probably sound like a broken record but I was looking at some push notification plugins outside the Parse sphere and quite a few support display notifications while the app is in the foreground. Here's two:
https://github.com/AppGyver/PushNotifications
https://github.com/phonegap-build/PushPlugin
I've looked at a bunch of forks of this one and I can't tell if any of them do it. A couple seemed to but had various bugs preventing it from actually working. And the rest don't have updated documentation so it's really hard to tell what they do and how to use it.
So, here's what I'm wondering:
- Is there some way to combine this Parse plugin with another plugin (like the main Phonegap build one) to support displaying notifications in the app / receiving the payload when starting the app from a notification?
- Can the READMEs for the forks of this plugin get updated with code examples?
- If a fork has diverged from this master repo, could it be turned into a new separate repo so we can have issue threads over there?
- Could someone do a tutorial on how to display notifications while the app is running, for iOS and Android, if you already have it working in your app?
I added a Pull Request for notification callbacks: https://github.com/avivais/phonegap-parse-plugin/pull/52. In the mean time it is available in my branch: https://github.com/grrrian/phonegap-parse-plugin
Sounds very nice and I promise to check it out soon. Don't forget to update README.md btw! Or not! It's cool :)
Credits to mypark for the inspiration.
@Montoya sorry I didn't write back earlier - been out of the loop on this for quite a while. Did you ever get a plugin that worked for you?
No, but I also haven't cared since I heard that Parse is shutting down -__-