Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Tuturiga Alexandru
15,353 PointsGCM for Android notification with multiple text lines
Hi,
After implementing push notifications through GCM on my Android app i've encountered a new , pretty small, issue that i can't find a fix for.
I'm sending the text for the notification from my own server and i need to write at least 2 lines of text. In order to do that i need a "line breaker" after each line. Tried sending \n after each line of text but it had no effect. Actually the result of having \n in the text was showing \n in the notification. Got any suggestions for me?
Thanks
2 Answers
Tuturiga Alexandru
15,353 PointsI have tried all of the above and it didn't work as expected. I've searched massively on google and found out that you actually need a custom view if you need a multilined push message. For this the best practice i've found is using RemoteViews and add the data to the view manually. After that just tell the builder to use the view..
Thank you for the response.
Ben Jakuben
Treehouse TeacherI don't have a good answer as I've never tried this...have you tried escaping the backslash somehow? Or maybe searching for \n and replacing it in the string? Log the message and see how the raw data looks...perhaps that could give a hint.