[英]Android: Send a notification to notification bar from php server to android application
I wanted to send a notification to android client from the server(php), which will be displayed to the user through notification bar. 我想从服务器(php)向Android客户端发送通知,该通知将通过通知栏显示给用户。 How can I do this! 我怎样才能做到这一点! please provide a good tutorial on this Thanks :) 请为此提供一个很好的教程:)
From the 26th of June, 2012 Google has deprecated C2DM in favour of Google Cloud Messaging for Android (GCM). 从2012年6月26日起,Google弃用了C2DM,转而使用Android的Google Cloud Messaging(GCM)。
All the docs and info relating to GCM can be found at http://developer.android.com/guide/google/gcm/index.html including details on how to migrate from C2DM to GCM. 有关GCM的所有文档和信息都可以在http://developer.android.com/guide/google/gcm/index.html上找到,包括有关如何从C2DM迁移到GCM的详细信息。
The solution I can think of is to use Cloud to Device Messaging (C2DM), the Android equivalent push notifications. 我能想到的解决方案是使用Cloud to Device Messaging(C2DM),即Android等效的推送通知。
For that you will have to: 为此,您将必须:
The above steps are just an overview, I personally learned C2DM using this tutorial and suggest you do the same. 上面的步骤只是一个概述,我个人是使用本教程学习C2DM的,建议您这样做。 Try running the code he has provided. 尝试运行他提供的代码。
the easiest way to get push notification from server is to use c2dm server. 从服务器获取推送通知的最简单方法是使用c2dm服务器。 Using c2dm server you can push message to any android device. 使用c2dm服务器,您可以将消息推送到任何android设备。 The best tutorial for c2dm is, 对于c2dm最好的教程是
http://www.vogella.de/articles/AndroidCloudToDeviceMessaging/article.html http://www.vogella.de/articles/AndroidCloudToDeviceMessaging/article.html
you can get detailed information regarding c2dm over here. 您可以在此处获取有关c2dm的详细信息。
And you can check this post to register application server with c2dm and to send message from server to android device via c2dm server, C2DM implementation PHP code 您可以检查此帖子以向c2dm注册应用服务器,并通过c2dm服务器( C2DM实现PHP代码)将消息从服务器发送到android设备
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.