push notification android with gcm

时间:2016-04-04 17:12:57

标签: android push-notification google-cloud-messaging

I want to develop an android application having push up notification. the notification will be shown when admin upload new in the website or announce message in the admin account in mobile application. Generally speaking, I want the push up notification done by website and mobile application. I have searched almost for 3 days but it is difficult to do it successfully. I know GCM can do this. But I do not know how to use it properly. I have watched many tutorial video but it does not work. Is there anybody has experience doing push up notification in android using GCM. Can you teach me?

2 个答案:

答案 0 :(得分:0)

I suggest you do the following:

1) find out your device's GCM token 2) send a push notification to that device using a software like POSTMAN or a CURL command (push notifications are actually REST requests) 3) set up your backend to actually do step #2 4) Enjoy

答案 1 :(得分:0)

您可以按照此tutorial了解如何在Android Studio中使用GCM推送推文通知。

您可以在此处了解如何使用推送通知设置项目的分步过程。

  • 在Google Developer Console上创建项目
  • 启用Google Cloud消息传递API
  • 生成服务器密钥和项目编号以供进一步使用
  • 使用项目编号
  • 从Android注册应用程序
  • Google会返回一个注册ID,将此ID发送到您的服务器
  • 从您的服务器向GCM发送消息到相应的注册ID
  • GCM将通过BroadCast Receiver向您发送推送消息并将其显示为通知

本教程还包含一些图片,供开发人员在设置项目时轻松学习。

  

请注意,此服务仅适用于发送的小邮件   客户端应用程序:4096字节是限制,所以只有轻量级   信息可以发送。