如何将通知从网站发送到android应用 [英] how to send notifications from a website to an android app

查看:100
本文介绍了如何将通知从网站发送到android应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用一些javascript和php创建了一个html网站. 我已经使用eclipse和java制作了一个android应用程序. 我需要使用什么代码,软件或技术来允许我的网站向我的应用程序发送通知.最终将通知从我的应用发送回我的网站.

I have made a website in html using a bit of javascript and php. I have made an android application using eclipse and java. what code or software or technique do i need to employ to allow my website to send notifications to my applications. And eventually send notifications from my app back to my website.

一天的目标是将通知从我的网站发送到特定Android设备上的特定应用.

the aim one day is to send notifications from my website to a specific app on a specific android device.

请回答我的问题或提供解决方案的链接.并请原谅我的无知.

Please answer my question or provide links to a solution. and excuse my ignorance as i am new to this.

推荐答案

要将通知发送到任何android设备,您可以使用两种技术: 1)推. 2)拉.

For sending Notification to any android Device you can use two technology: 1) Push. 2) Pull.

对于Push Technology,您可以使用GCM(Google云消息传递).

对于Pull Technology,您可以使您的应用程序不断与服务器保持连接,并尝试从那里获取数据.

For Push Technology you can use GCM(Google cloud messaging).

For Pull Technology you can make you application continuously keep on connecting to server and trying to fetch data if it is available from there.

GCM的优势:
1)电池电量低.因为它将消息推送到用户设备,并且当用户连接到服务器时也会推送消息.

Advantages of GCM:
1) Low battery comsumption. Since it will push the message to user device and it will push message when user gets connected to server.


对于GCM,您可以使用以下链接作为参考:
1) http://developer.android.com/google/gcm/gs.html
2) http://www.techrepublic .com/blog/app-builder/implementing-googles-cloud-to-device-messaging/428
3) http://www.vogella.com/articles/AndroidCloudToDeviceMessaging/article.html
4) https://github.com/teleknEsis/TechRepublic-Samples/tree/master/C2​​DMSample


For GCM you can use following Link for your reference:
1) http://developer.android.com/google/gcm/gs.html
2) http://www.techrepublic.com/blog/app-builder/implementing-googles-cloud-to-device-messaging/428
3) http://www.vogella.com/articles/AndroidCloudToDeviceMessaging/article.html
4) https://github.com/teleknEsis/TechRepublic-Samples/tree/master/C2DMSample

这篇关于如何将通知从网站发送到android应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆