且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法收到推送通知在Android中使用trigger.io和parse.com

更新时间:2022-10-26 11:43:24

这是一个公正的,当你使用的是默认的广播问题 - 而不是一个名为 - 通道

我们有一个与Android上的广播信道准备一个问题的修正,以在明天或下周初部署 - 这将是平台版本v1.4.27


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?

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.