Skip to content

Incrementing a push notification badge number support coming soon? #723

Description

@taufiq-husain

How can I tell whether the open source server will support something or whether I should implement a solution myself? I noticed that on the detailed docs, it said that Parse server doesn't support iOS badge numbers yet. Does this mean it's coming soon? Could I please know when/how I can help to speed this particular part? My project needs to be live on the app store within a week and this part is the only broken part.

I've successfully set up cloud code and fixed up my iOS front-end codes to use the Parse server. Thank you guys so much for everything you're doing with this. Highly appreciate it!

Activity

  1. flovilmart commented on Mar 1, 2016

    @flovilmart
    Contributor

    As per the documentation it seems that the badge is supported: https://github.com/ParsePlatform/parse-server/wiki/Push#api

  2. anatolydwnld commented on Mar 1, 2016

    @anatolydwnld

    I think this ticket was about supporting Increment as the badge value(https://parse.com/docs/rest/guide#push-notifications-sending-options). Please, re-open.

  3. flovilmart commented on Mar 1, 2016

    @flovilmart
    Contributor

    Did you try badge: "increment" ? It should to the job

  4. taufiq-husain commented on Mar 1, 2016

    @taufiq-husain
    Author

    You can see in Parse's Push wiki, it says that this hasn't been implemented "yet". Link: https://github.com/ParsePlatform/parse-server/wiki/Push. That's why I was asking if/when/whether it'll ever be implemented...

  5. flovilmart commented on Mar 1, 2016

    @flovilmart
    Contributor

    Right.

  6. anatolydwnld commented on Mar 1, 2016

    @anatolydwnld

    Just to double check, I tested badge: "increment". Didn't work. There doesn't seem to be any mention of this in the source either. The wiki is correct in stating that this feature is not yet implemented.

  7. flovilmart commented on Mar 1, 2016

    @flovilmart
    Contributor

    PR is pending review

  8. taufiq-husain commented on Mar 7, 2016

    @taufiq-husain
    Author

    Hi,

    I've updated my package.json file to "parse-server": "~2.1.4" but the "Increment" push notification feature doesn't seem to work still. I'm using the standard iOS APN system explained here: https://github.com/ParsePlatform/parse-server/wiki/Push. I deployed my code to my Heroku server by updating the package number but the push notification feature still doesn't increment. When I use the badge: 1 feature which works well but the increment feature doesn't. In fact, if I put the badge as "Increment", the badge doesn't update at all. What am I doing wrong? Did I not update the Parse server properly on Heroku? Do I need to do something more?

    Thanks.

  9. taufiq-husain commented on Mar 7, 2016

    @taufiq-husain
    Author

    I've also updated using the instructions given here: #879

    Any ideas why it's not working still @flovilmart ?

  10. flovilmart commented on Mar 7, 2016

    @flovilmart
    Contributor

    Can you run a query on _Installation to see if the badge value increments correctly? The badge increment is only for iOS devices, (deviceType=ios should be set on _Installation).

    Also when you say not working at all, what do you mean?

  11. taufiq-husain commented on Mar 7, 2016

    @taufiq-husain
    Author

    I did. The badge is still showing zero.

    Here is my package.json:

    {
      "name": "parse-server-example",
      "version": "1.1.0",
      "description": "An example Parse API server using the parse-server module",
      "main": "index.js",
      "repository": {
        "type": "git",
        "url": "https://github.com/ParsePlatform/parse-server-example"
      },
      "license": "MIT",
      "dependencies": {
        "express": "~4.2.x",
        "kerberos": "~0.0.x",
        "parse": "~1.6.12",
        "parse-server": "~2.1.4"
      },
      "scripts": {
        "start": "node index.js"
      },
      "engines": {
        "node": ">=4.3"
      }
    }
    

    I'm using cloud code to send push notifications. As soon as I change the badge value to "1", it works. As soon as I change it "Increment", it stops showing any numbers. It just shows 0 for the receiving user's badge in the _Installation row.

    Here is me updating my Parse Server:

    Taufiqs-MBP:getlolapp Taufiq$ cd parse-server
    Taufiqs-MBP:parse-server Taufiq$ git checkout master
    Already on 'master'
    Your branch is up-to-date with 'origin/master'.
    Taufiqs-MBP:parse-server Taufiq$ git pull
    Already up-to-date.
    Taufiqs-MBP:parse-server Taufiq$ cd ..
    Taufiqs-MBP:getlolapp Taufiq$ git commit -am "Testing"
    [master d911f50] Testing
     1 file changed, 1 insertion(+), 1 deletion(-)
    Taufiqs-MBP:getlolapp Taufiq$ git push heroku master
    Counting objects: 3, done.
    Delta compression using up to 8 threads.
    Compressing objects: 100% (2/2), done.
    Writing objects: 100% (3/3), 287 bytes | 0 bytes/s, done.
    Total 3 (delta 2), reused 1 (delta 1)
    remote: Git submodules detected, installing:
    remote: Synchronizing submodule url for 'parse-server'
    remote: Submodule path 'parse-server': checked out '75ae95815d30c99f67119301ef8619cbf0606cfe'
    remote: 
    remote: Compressing source files... done.
    remote: Building source:
    remote: 
    remote: -----> Using set buildpack heroku/nodejs
    remote: -----> Node.js app detected
    remote: 
    remote: -----> Creating runtime environment
    remote:        
    remote:        NPM_CONFIG_LOGLEVEL=error
    remote:        NPM_CONFIG_PRODUCTION=true
    remote:        NODE_ENV=production
    remote:        NODE_MODULES_CACHE=true
    remote: 
    remote: -----> Installing binaries
    remote:        engines.node (package.json):  >=4.3
    remote:        engines.npm (package.json):   unspecified (use default)
    remote:        
    remote:        Resolving node version >=4.3 via semver.io...
    remote:        Downloading and installing node 5.7.1...
    remote:        Using default npm version: 3.6.0
    remote: 
    remote: -----> Restoring cache
    remote:        Loading 2 from cacheDirectories (default):
    remote:        - node_modules
    remote:        - bower_components (not cached - skipping)
    remote: 
    remote: -----> Building dependencies
    remote:        Pruning any extraneous modules
    remote:        Installing node modules (package.json)
    remote: 
    remote: -----> Caching build
    remote:        Clearing previous node cache
    remote:        Saving 2 cacheDirectories (default):
    remote:        - node_modules
    remote:        - bower_components (nothing to cache)
    remote: 
    remote: -----> Build succeeded!
    remote:        ├── [email protected]
    remote:        ├── [email protected]
    remote:        ├── [email protected]
    remote:        └── [email protected]
    remote:        
    remote: 
    remote: -----> Discovering process types
    remote:        Procfile declares types     -> (none)
    remote:        Default types for buildpack -> web
    remote: 
    remote: -----> Compressing...
    remote:        Done: 20.5M
    remote: -----> Launching...
    remote:        Released v67
    remote:        https://getlolapp.herokuapp.com/ deployed to Heroku
    remote: 
    remote: Verifying deploy... done.
    To https://git.heroku.com/getlolapp.git
       e066c75..d911f50  master -> master
    
  12. flovilmart commented on Mar 7, 2016

    @flovilmart
    Contributor

    what is the deviceType for your _Installation?

  13. 6 remaining items

  14. taufiq-husain commented on Mar 7, 2016

    @taufiq-husain
    Author

    yeah, I wonder why? I was using the following function:

    // Push Notifications
    Parse.Cloud.define("send_push", function(request, response) {
        var query = new Parse.Query(Parse.User, {useMasterKey:true});
        query.containedIn("username", request.params.receivers);
        query.equalTo("enabled", true);
        Parse.Push.send({
            where: query,
            data: {
                alert: request.params.message,
                badge: "Increment"
            }
        }, 
        { 
            useMasterKey: true 
        }, 
        {
            success: function() {
                response.success("Push notification sent!");
            },
            error: function(e) {
                response.error("Push notification error! Code: " + e.code + ", Message: " + e.message);
            }
        });
    });
    

    Why is badge being sent as "undefined"?

  15. taufiq-husain commented on Mar 7, 2016

    @taufiq-husain
    Author

    Maybe Parse server expects an integer instead of string for the badge value? I have no clue why this is not working but badge: 1 works. @flovilmart

  16. flovilmart commented on Mar 7, 2016

    @flovilmart
    Contributor

    not sure, we have unit tests to make sure everything is functional, this part is heavily tested through he PushController.

    I just noticed that your push query is on Parse.User, that is maybe the problem now.
    It should be a query on _Installation

  17. taufiq-husain commented on Mar 7, 2016

    @taufiq-husain
    Author

    I updated the cloud code to the following and it still isn't working (shows the same "undefined" badge error):

    // Push Notifications
    Parse.Cloud.define("send_push", function(request, response) {
        var Installation = Parse.Object.extend("_Installation");
        var query = new Parse.Query(Installation, {useMasterKey:true});
        query.containedIn("username", request.params.receivers);
        query.equalTo("enabled", true);
        Parse.Push.send({
            where: query,
            data: {
                alert: request.params.message,
                badge: "Increment"
            }
        }, 
        { 
            useMasterKey: true 
        }, 
        {
            success: function() {
                response.success("Push notification sent!");
            },
            error: function(e) {
                response.error("Push notification error! Code: " + e.code + ", Message: " + e.message);
            }
        });
    });
    

    Do you have any sample apps that you can test to see if "Increment" push notifications are working properly?

  18. camerona93 commented on Mar 23, 2016

    @camerona93

    I'm seeing the same behavior as taufiq in my heroku setup as well - all of my push notifications show up but the badge is never incremented despite having badge: "Increment" in the data parameter. My MongoDB entries for installations show badge count staying at 0. Is there any update on this?

  19. taufiq-husain commented on Mar 29, 2016

    @taufiq-husain
    Author

    @cra5370 I don't know if you fixed this issue yet but my heroku server started working after updating to the most recent Parse server version. If you used git to set up heroku then follow these steps and it might start working properly:

    heroku git:clone -a my_app
    cd my_app
    git submodule add https://github.com/ParsePlatform/parse-server.git
    npm link parse-server ./parse-server
    cd parse-server
    git checkout master
    git pull
    cd ..
    git commit -am “Testing”
    git push heroku master
    

    Other than that, you should look into the docs furthermore. Amazing guys like @flovilmart and the rest of the Parse team are doing a wonderful job keeping and making Parse great and open source.

  20. aliasad106 commented on May 14, 2016

    @aliasad106

    @flovilmart
    I am facing the same problem I update parse-server to latest and tested locally and it started showing badge for "increment" but when I deployed to AWS Elasticbeanstalk, It doesn't show badge.

    P.S: I'm using Docker for AWS elasticbeanstalk deployment. It was also giving me error for mailgun adaptor file. Docker dose not seem to be updated with current parse-server directories.

  21. miighty commented on Oct 16, 2016

    @miighty

    Hey any progress on this?
    I seem to have the same problem badge: "Increment" doesn't work but I can set the badge via integer. Im super new to node.js and parse.

    Is there a way to get the badge value so I can then count that up ?

  22. flovilmart commented on Oct 16, 2016

    @flovilmart
    Contributor

    What version of parse-server are you running? The increment should be implemented for a while.

  23. miighty commented on Oct 16, 2016

    @miighty

    I belive I am running 1.2.0, but It's a parse server for Microsoft Azure

  24. flovilmart commented on Oct 16, 2016

    @flovilmart
    Contributor

    Parse server versions start from 2.0.0, the current version is 2.2.22.

  25. miighty commented on Oct 16, 2016

    @miighty

    Whoops sorry, in that case the version is 2.1.4, which judging by the current version is very old...

  26. flovilmart commented on Oct 16, 2016

    @flovilmart
    Contributor

    Yes syou should upgrade then!

  27. jeacott1 commented on Jul 4, 2017

    @jeacott1

    someone should probably update the docs to reflect this sometime.
    http://docs.parseplatform.org/parse-server/guide/#api

    "Here is the list of sending options we do not support yet:
    push_time for scheduled push
    Increment badge under data for iOS badge number"

  28. flovilmart commented on Jul 4, 2017

    @flovilmart
    Contributor

    Yes! Could you do it @jeacott1 ? Push schedule is saved but not run though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions