Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ios notification is not working with title. #162

Closed
0xp3p3 opened this issue Dec 24, 2016 · 20 comments
Closed

ios notification is not working with title. #162

0xp3p3 opened this issue Dec 24, 2016 · 20 comments
Assignees
Labels

Comments

@0xp3p3
Copy link

0xp3p3 commented Dec 24, 2016

{
  "notifications": [
    {
      "tokens": ["token_a", "token_b"],
      "platform": 1,
      "message": "Hello World iOS!"
    }
  ]
}

This is working.

"notifications": [
    {
      "tokens": ["token_a", "token_b"],
      "platform": 1,
      "message": "Hello World iOS!",
      "title": "You got message"
    }
  ]

but this is not working with title.

Merry Xmas!
Thanks for your support again

@0xp3p3
Copy link
Author

0xp3p3 commented Dec 24, 2016

@appleboy I found reason why ios title is not working.
ios notification type is like that. that is default. gorush is sending like that.
{"aps":{"alert":"message"}}
but if we will need title, alert type must be like that
{"aps":{"alert":{"body":"message", "title":"title"}}}
Looking forward to hearing from you soon

@0xp3p3
Copy link
Author

0xp3p3 commented Dec 24, 2016

@appleboy so I have just checked your source project.
currently, to show title on ios platform, we can do like this.

{
  "notifications": [
    {
      "tokens": ["token_a", "token_b"],
      "platform": 1,
      "title": "title",
      "alert": {"body": "message"}
    }
  ]
}

or we can user subtitle of alert instead of title.

{
  "notifications": [
    {
      "tokens": ["token_a", "token_b"],
      "platform": 1,
      "alert": {
            "body": "message",
            "subtitle": "title"
      }
    }
  ]
}

I think, gorush has to not use message field on ios platform.

@appleboy
Copy link
Owner

appleboy commented Dec 24, 2016

I will take it. I got the point.

appleboy added a commit that referenced this issue Dec 24, 2016
Fix #162
Fix #146

//     "aps" : {
//         "alert" : {
//             "title" : "Game Request",
//             "body" : "Bob wants to play poker",
//             "action-loc-key" : "PLAY"
//         },
//         "badge" : 5
//     },

and

//     "aps" : {
//         "alert" : "You got your emails.",
//         "badge" : 9,
//         "sound" : "bingbong.aiff"
//     },

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
@appleboy
Copy link
Owner

You can try the following example:

https://github.com/appleboy/gorush#ios-example

  "notifications": [
    {
      "tokens": ["token_a", "token_b"],
      "platform": 1,
      "badge": 5,
      "alert": {
        "title" : "Game Request",
        "body" : "Bob wants to play poker",
        "action-loc-key" : "PLAY"
      }
    }
  ]

@0xp3p3
Copy link
Author

0xp3p3 commented Dec 24, 2016

@appleboy perfect! I got it.

@appleboy
Copy link
Owner

Bumping version now. Please wait.

@0xp3p3
Copy link
Author

0xp3p3 commented Dec 24, 2016

And then, I have one request for gorush.
currently, same badge could be selected on every devices in ios platform. but in the development, every device's badges will be different. I think, badge will be included in data, so developers can use badge on every devices differently. Actually, android platform has not badge field. That is only my asking, anyway gorush is perfect meanwhile using.

@appleboy
Copy link
Owner

@appleboy
Copy link
Owner

Please let me know it is working or not. Thanks.

@0xp3p3
Copy link
Author

0xp3p3 commented Dec 24, 2016

@appleboy I have just checked v1.7.2
ios platform is working fine. but android platform is not working
I have checked with title and with out title. and I have checked v1.7.1 again. v1.7.1 is working fine

v1.7.1

�[37mDEBU�[0m[2016/12/24 - 16:48:41] Start push notification for Android
�[37mDEBU�[0m[2016/12/24 - 16:48:41] Android Success count: 1, Failure count: 0
�[34mINFO�[0m[2016/12/24 - 16:48:41] |�[97;42m succeeded-push �[0m| �[97;43mandroid�[0m [**********M:APA91bGNkfSdVZ79tFl9uomyEYYSR-TI25i2C6v-pIXoJqxpk1pHXVs2kUaH9PVeG-AeiNPIrEZIKJ0xC6MJ_wp1sh0cb1apX9C_M1_BF_fEAteYILtfxe8F9aawJE72KV**********] message test.

v1.7.2

time="2016/12/24 - 16:49:03" level=debug msg="Start push notification for Android"
time="2016/12/24 - 16:49:04" level=error msg="GCM server error: error sending request to GCM HTTP server: error unmarshaling json from body: json: cannot unmarshal number 4698167438340355184 into Go value of type int"

my request param is as follow

{"notifications":[
	{
		"tokens":["token"],
		"platform":2,
		"message":"message test."
	}
	]
}

@0xp3p3 0xp3p3 changed the title ios notification is not working with tile. ios notification is not working with title. Dec 24, 2016
@appleboy
Copy link
Owner

appleboy commented Dec 24, 2016

v1.7.2 is working for android platform. Test binary: gorush-v1.7.2-darwin-amd64

screen shot 2016-12-24 at 5 11 43 pm

@appleboy appleboy self-assigned this Dec 24, 2016
@appleboy appleboy added the bug label Dec 24, 2016
@0xp3p3
Copy link
Author

0xp3p3 commented Dec 24, 2016

I have checked on windows version.

@0xp3p3
Copy link
Author

0xp3p3 commented Dec 24, 2016

@appleboy I have just checked on linux verison.
That is working fine on both platform. but as I checked, window version really is not working on android platform.

@appleboy
Copy link
Owner

I will try the windows version later.

@0xp3p3
Copy link
Author

0xp3p3 commented Dec 24, 2016

thanks, looking forward to hearing from you soon.

@0xp3p3
Copy link
Author

0xp3p3 commented Dec 24, 2016

one more, when i finish gorush listen service on linux, it is not finished immediately

I have just pressed Ctrl+C, and i pressed several times after this. but service is not finished immediately.
v1.7.1 was working fine.

^C3751 Received SIGINT.
3751 [::]:8088 Listener closed.
3751 Waiting for connections to finish...
^C3751 Received SIGINT.
^C3751 Received SIGINT.
^C3751 Received SIGINT.
^C3751 Received SIGINT.
^C3751 Received SIGINT.
^C3751 Received SIGINT.
^C3751 Received SIGINT.
^C3751 Received SIGINT.
^C3751 Received SIGINT.
^C3751 Received SIGINT.
[STOP - Hammer Time] Forcefully shutting down parent
3751 Serve() returning...

If you need, I will check gorush windows version and linux version continuously in the future 👍

@appleboy
Copy link
Owner

v1.7.2 is also working on window-amd64.

screen shot 2016-12-24 at 5 35 09 pm

@0xp3p3
Copy link
Author

0xp3p3 commented Dec 24, 2016

perhaps, do i need go get again?
$ go get -u -v github.com/appleboy/gorush

@appleboy
Copy link
Owner

appleboy commented Dec 24, 2016

No, I just download the binary from https://github.com/appleboy/gorush/releases/tag/v1.7.2

You don't need to install any Go package in your windows OS.

@0xp3p3
Copy link
Author

0xp3p3 commented Dec 24, 2016

hahaha
@appleboy window version is working fine.
I checked with gorush-v1.7.2-windows-386.exe before. sorry for now,

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

No branches or pull requests

2 participants