android - Google cloud messaging GCM through proxy -


I'm having trouble sending a message to a device via a company's proxy.
I have done a GCM tutorial on Google Sites and successfully registered a device on Google servers with Android emulator, and at the end of my life also on the server
For this, I had to go through the company proxy, to set it in the access point of the emulator. Now I have a problem sending one device from my server to the device via the same proxy. I am using the servlet code from the demo which send

  com.google. Android.gcm.server.Sender   

Uses an Assistant Class. .

I am running servlets on the Tomcat 7.

I have tried to set up a proxy, such as in the catalina.properties file.

  http.proxyHost = proxy.company.com http.proxyPort = 8080   

And I have tried to install properties inside the servlet as below . System .setProperty ("http.proxyHost", "proxy.company.com"); System.setProperty ("http.proxy port", "8080");

But even then I'm out of time I know the proxy of its company because I have got home-based messaging where I have no proxy.

I have seen a proxy object created in java code and then made a connection, but I do not think it is useful here because i am using the sender helper class to send the message.

This is a time, which fails in timeout.

  Result Results = Sender Send (Message, Registration ID, 5);    

-text "itemprop =" text ">

OK In the end, I have done this work. In my comment I told that I was successful in sending the message, but the emulator was not receiving it. I forgot to follow my previous advice and from the command line to the emulator the proxy parameters Forgot to set as:

emulator.exe -avd avd22google -http-proxy proxy.company.com:8080 - debug-proxy

So in short, my The initial problem was that I registered an emulator with GCM and with my local server, but when I sent the message, I was out of time.

I initially thought that this firewall , So I did some research and set up a proxy in Tomcat's Catalina.Propainties file.

I use the "Charles" web proxy debugger software to see it Where the message was being sent and it came with

, I initially added the following to my catalina.properties file:

  https.proxyHost = Proxy.company.com https.proxyPort = 443   

It still does not work. One of my associates told me that our company handles all kinds of requests through proxy port 8080, so I changed the port line to:

  https.proxyPort = 8080   

This allowed the message to be sent out. But then the message was not getting through the emulator and I got the following error in the logcat.

  [GTalkConnection.12] doConnect: Contact XMPPError mtalk.google.com .228. : - due to: java.net.SocketException: Operation timed out   

Then I remembered that you have to start the emulator with the command line to use a proxy. Once I did this, there was a flood of messages on my emulator!

So I finally finished the job at the end. GCM has completely taken me about a week to work within my company firewall, so hopefully this post can help such poor people in the future.

cheers

Bill

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -