GCM推送通知不通过代理来 [英] GCM push notifications not coming through proxy

查看:196
本文介绍了GCM推送通知不通过代理来的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发展我的课程项目一个小应用程序(类似Snapchat),允许一个发送和接收图片和视频。我使用的是被称为巴斯解析它使用GCM提供推送通知。然而,问题是,我的校园里使用代理网络,由于其众多的应用程序不工作(的WhatsApp,Instagram的),而一些应用程序(Snapchat)工作,但他们未能发送通知。同样是与我的应用程序的情况。

I'm developing a small app for my course project (similar to Snapchat) that allows one to send and receive pictures and videos. I'm using a BaaS called Parse which uses GCM to deliver push notifications. However, the problem is that my campus uses a proxy network due to which numerous apps do not work (WhatsApp, Instagram) while some apps (Snapchat) work but their notifications are not delivered. Same is the case with my app.

是否有来克服这个问题假设我没有对代理服务器网络和蜂窝网络的任何影响的任何可能的方式是选自选项。

Is there any possible way to overcome this problem assuming I do not have any influence over the proxy network and cellular network is out of options.

推荐答案

这一切都取决于你的校园网络访问策略。你不能做,如果你的校园代理防火墙犯规提供访问这些网站。但是,你可以问他们,让这些URL通过他们的代理防火墙。

It all depends on your campus network access policy. You cant do if your campus proxy firewall doesnt provide access to these sites. However, you can ask them to allow these URL through their proxy firewall.

或者,干脆您可以通过添加在你的code线使用一些其他的外部代理服务器

Or, simply you can use some other external proxy server by adding lines in your code

System.setProperty(https.proxyHost,<知识产权及GT;);
 System.setProperty(https.proxyPort,<港口和GT;);

在这里你试图连接谷歌的API。说,如果你使用的是这样的事情,

where you are trying to connect the Google APIs. Say if you are using something like this,

URL url = new URL("https://android.googleapis.com/gcm/send");
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("Authorization", "key="+<your api key>);

这几行,你试图连接到谷歌API之前,添加代理设置的线条,上面两行。此外,尝试你的校园代理,以及其他一些外部的代理,你会知道问题是与你的校园代理或没有。

Before these lines where you attempting to connect to Google API, add the proxy setting lines, the above two lines. Also, try with your campus proxy as well some other external proxy, you will come to know issue is with your campus proxy or not.

试试这个,希望这有助于你的问题.. !!!!!

Try this, hope this helps with your problem..!!!!!

这篇关于GCM推送通知不通过代理来的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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