1

I have the requirement to send a PUSH notification to an android client from my java class. The class has been written using the guidelines provided at the url : http://www.vogella.de/articles/AndroidCloudToDeviceMessaging/article.html (Section 2.4 - Send Messages) This works fine on the standard application servers like JBOSS and Weblogic.

But the application needs to be moved to google app-engine but the class throws a compilation error saying : 'The class javax.net.ssl.HostnameVerifier is not supported by GAE's Java runtime environment'. Similar error is thrown for 'SSLSession' class too.

Is there a way this can be overcome ? Or is there is any other way to send PUSH notifications from Java classes running on the app-engine ?

Thanks, Vinay

2 Answers 2

1

It can't be overcome directly, meaning you can't make those classes run on GAE. As for a solution, I'm not sure why you would want to use a custom HostnameVerifier, so just try without it: use HttpURLConnection instead of HttpsURLConnection and remove all the "hostnameVerifier" parts.

Edit: you can also use App Engine's fetch API, that is supported for sure.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for the reply Viruzzo...I changed it to HttpURLConnection and removed the private class extending HostNameVerifier, but get a new error at runtime saying java.lang.NoClassDefFoundError: javax.net.SocketFactory is a restricted class. Please see the Google App Engine developer's guide for more details. when the method is executed. Might be because sockets are not supported fully by GAE ? Do you know if there is any other way to achieve PUSH from Java on GAE?
Where does it throw it? There is no explicit reference to it in the code you linked. You only need to do a simple POST to the C2DM server to do push, so it should work perfectly fine with HttpURLConnection on GAE.
0

Regarding your question Is there is any other way to send PUSH notifications from Java classes running on the app-engine?, the answer is yes, third party services such as Beaconpush or Spire.io could be integrated well with app engine, and in some cases could be much cheaper in terms of cost compared to using the App Engine Channel API.

3 Comments

Hi Ibrahim, Can you confirm if they can be plugged into Java classes ? The requirement is to send PUSH notifications from Java classses which are running on App-Engine.
He is already using Google's C2DM, that is exactly the same service as those two; he is having problem accessing the service, he doesn't want to (and shouldn't) implement a push service.
@Viruzzo: I answered his valid question and give him valid alternatives for his considerations, why the need for downvotes? Vinay: You could use their REST API to push messages via URLFetch API, that's what I did on my app.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.