Skip to content
This repository has been archived by the owner on Jun 6, 2021. It is now read-only.

Cannot send localized notifications #139

Open
rjourde opened this issue Jun 1, 2016 · 1 comment
Open

Cannot send localized notifications #139

rjourde opened this issue Jun 1, 2016 · 1 comment

Comments

@rjourde
Copy link

rjourde commented Jun 1, 2016

The setData function does not allow to send localized notifications as custom data are not inserted into the aps array. We should be able to do the following:

$payload = array(
            "alert" => array("loc-key" => $localizedData),,
        );

$message->setData($payload);

and we should get the following payload:

{
  "aps": [
    "alert": {
      "loc-key": "my message"
    }
  ]
}

instead of

{
  "aps": [ ]
  "alert": {
    "loc-key": "my message"
  }
}
@grago
Copy link

grago commented Mar 2, 2017

I got this working by using setMessage instead of setData:

$message->setMessage(['loc-key' => 'my message']);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants