Meteor-Push - android.data must only contain string values

I am attempting to integrate ActiveTree:Meteor-Push into my app for iOS and Android. I have followed the example found in the repo and am able to get the notifications to fire successfully but when they do I experience never-ending repeating errors that state that “android.data must only contain string values”.

I have spent literal hours reading the small amount of documentation available, and exhaustively reviewing both the example app as well as the actual implementation of the package on github and am still unsure what I am doing wrong.

I had attempted to ask a question in the github issues for the package but have yet to receive a response so I thought I would try here.

I have noticed that I do not receive the error if there are no devices registered _push_app_tokens collection in the db, but if I register an iPhone, this is what happens.

I have included relevant code and output snippets below - as you can see each value inside of the android.data object is a string. I can determine no way to alter this object despite various attempts.

App Token:

{
  "_id": "vTx4c9p23hJgJzKFw",
  "token": {
      "apn":"eWUoR1R3yEY:APA91bGqTgfHtOARjGP..."
   },
   "appName":"App Name",
   "userId":"5e207e5702dd88273aca77b4f",
   "enabled":true,
   "createdAt":"1611549799035.0",
   "updatedAt":"1611549807207.0"
 }

Notification send:

        Push.send({
            from: 'Test',
            title: 'TEST',
            body: 'this is a test',
            userId: this.userId 
        })

Notification in _push_notifications collection:

{
"_id":"EWus4L7GAwzevQjty",
"createdAt":{"$numberDouble":"1611595420575.0"},
"createdBy":"<SERVER>",
"sent":false,
"sending":{"$numberInt":"60000"},
"from":"App name",
"title":"TEST",
"body":"this is a test",
"userId":"5e207e5702dd88273ac08b4f"
}

Error:

Push: Could not send notification id: "BrhNkZ9hntLCHCMCM", Error: android.data must only contain string values
Push: Send message "TEST" to user: [ '5e207e5702dd88273ac08b4f' ]
Send to token {
 apn: 'eWUoR1R3yEY:APA91bGqTgfHt...'
}
Final notification right before shoot out: {
    "android": {
        "priority": "HIGH",
        "data": {
            "title": "TEST",
            "body": "this is a test",
            "color": "#337FAE",
            "tag": "undefined",
            "channel_id": "appName",
            "notification_priority": "PRIORITY_DEFAULT",
            "visibility": "PRIVATE"
        },
        "fcm_options": {
        "analytics_label": "activitreeSomething"
    }
 },
 "apns": {
    "headers": {
         "apns-priority": "10"
    },
    "payload": {
        "aps": {
            "alert": {
                "title": "TEST",
                 "body": "this is a test",
                "launch-image": ""
            },
            "badge": 1,
            "sound": "",
            "data": {}
        }
    },
    "fcm_options": {
        "analytics_label": "activitreeSomething"
    }
 },
 "webpush": {
    "headers": {
        "Urgency": "high",
        "TTL": "3600000"
    },
    "data": {},
    "notification": {
        "title": "TEST",
        "body": "this is a test"
    },
    "fcm_options": {}
 }

If you have a valid android token, you could try to send your message payload for android via Postman and as you adjust the payload, see what key is not right (https://apoorv487.medium.com/testing-fcm-push-notification-through-postman-terminal-part-1-5c2df94e6c8d)

Alternatively you can check on this: https://github.com/activitree/meteor-push/issues/17

In the package documentation in Github it states:
"
For a successful processing of Android, please have all defaults set (although you might not have a sound file or icon etc) or send the keys within your notification method. Defaults are set in startup/server/push.js . When Android keys are missing and debugging is set to true you may receive this error: ‘android.data must only contain string values’.
"

Hi Tony,

Have you found the problem ? We’re struggling with the same issue.

Thanks for posting back your solution :slight_smile:

Regards,
Burni

1 Like

Ok found it. As Paul had said, one field was missing : sound