Skip to content

Instantly share code, notes, and snippets.

@ripzery
Last active October 18, 2016 23:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ripzery/e910f49d2aece5b714bad27f8823573f to your computer and use it in GitHub Desktop.
Save ripzery/e910f49d2aece5b714bad27f8823573f to your computer and use it in GitHub Desktop.
gcm structure from tsl which uses notification payload
10-18 23:58:21.170 25945-26010/com.socket9.thetsl D/MyGRcmListenerService: From: 197311876504
10-18 23:58:21.172 25945-26010/com.socket9.thetsl I/MyGcmListenerService: Bundle[{google.sent_time=1476809900797, type=SERVICE BOOKING, google.message_id=0:1476809900806468%43ae439143ae4391, notification=Bundle[{body=รถยนต์หมายเลขทะเบียน ปดก-2558 ได้นัดหมายเข้าใช้บริการที่ TSL Auto Service ในวันที่ 21/09/2016 เวลา 15:19:00 น., title=SERVICE BOOKING}], message={"th_data":{"date":"Wednesday, September 21, 2016","time":"3:19 pm","type":"บริการแบบ A","branch":"ศูนย์บริการภูเก็ต"},"th":"รถยนต์หมายเลขทะเบียน ปดก-2558 ได้นัดหมายเข้าใช้บริการที่ TSL Auto Service ในวันที่ 21\/09\/2016 เวลา 15:19:00 น.","en_data":{"date":"Wednesday, September 21, 2016","time":"3:19 pm","type":"Service A","branch":"Phuket Service Center"},"en":"Date confirm 21\/09\/2016 Time 15:19:00"}, collapse_key=com.socket9.thetsl}]
10-18 23:58:21.173 25945-26010/com.socket9.thetsl I/MyGcmListenerService: รถยนต์หมายเลขทะเบียน ปดก-2558 ได้นัดหมายเข้าใช้บริการที่ TSL Auto Service ในวันที่ 21/09/2016 เวลา 15:19:00 น.
@ripzery
Copy link
Author

ripzery commented Oct 18, 2016

จากการทดลอง comment code ส่วน build notification ขึ้นมาถ้าแอพรัน

background -> โชว notification
foreground -> ไม่โชว notification

สรุปว่าถ้ารันแบบ background ฟังก์ชั่น onMessageReceived จะไม่ทำงาน

@ripzery
Copy link
Author

ripzery commented Oct 18, 2016

About payload

image

จาก Use scenario แล้วคิดว่าถ้า server เอา notification payload ออก อาจจะทำให้ฟังก์ชั่น onMessageReceived ทำงาน

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment