Cannot receive push notifications in Android with trigger.io and parse.com

狂风中的少年 提交于 2019-12-02 05:36:21

问题



I have just started developing an app for Android and iPhone with trigger.io and parse.com. Now I'm stuck trying to add push notifications to the app. I send test pushes from the control panel at parse.com but nothing happens on the Android phone I'm testing with.

Here's what I've done:

  • Added the partners/parse section in config.json with applicationId and clientKey from the settings at parse.com

  • Added "event": true to the modules section in config.json

  • My config.json looks like this:

    {
      "config_version": "2",
      "name": "My test app",
      "author": "(my email)",
      "version": "0.1",
      "platform_version": "v1.4",
      "description": "An empty app created by default",
      "modules": {
        "logging": {
         "level": "DEBUG"
        },
        "event": true,
        "geolocation": true,
        "contact": true,
        "file": true,
        "is": true,
        "media": true,
        "notification": true,
        "prefs": true,
        "request": {
          "permissions": ["http://*/*", "https://*/*"]
        },
        "tools": true,
        "reload": true
      },
      "partners": {
        "parse": {
          "applicationId": "(my real app id)",
          "clientKey": "(my real client key)"
        }
      }
    }
    
  • Added the following code to listen for incoming pushes:

    forge.logging.info('Adding push listener');
    
    forge.event.messagePushed.addListener(function (msg) {
      forge.logging.info('Got push: ');
      forge.logging.info(JSON.stringify(msg));
    }, function(err) {
      forge.logging.error('There was an error receiving push!');
      forge.logging.error(err);
    });
    
  • To test the app I connect my Android phone by USB cable to my Mac and choose "Run android" in Trigger toolkit in the browser

  • In the log I see the messages "Initializing Parse and subscribing to default channel" and "Adding push listener"

  • I go to parse.com Push notifications and see that there is one connected device. I test to send several messages, some in "Message" mode, some in JSON mode.

  • Parse thinks that the messages get sent but nothing is logged on my side

  • I also tested connecting another Android phone. Parse then indicated that there were two reachable phones, but the new phone didn't get any messages either.

Looking at the documentation and examples I can't think of anything else to try. I cannot decide if this is a trigger.io problem or a parse.com problem.

Does anyone have any ideas?


回答1:


Is this a problem just when you're using the default broadcast - rather than a named - channel?

We have a fix for a problem with the broadcast channel on Android ready to be deployed tomorrow or early next week - it will be in platform version v1.4.27.



来源:https://stackoverflow.com/questions/14499947/cannot-receive-push-notifications-in-android-with-trigger-io-and-parse-com

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!