Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of How to send android push notification without ssl certificate without wasting too much if your time.
The question is published on by Tutorial Guruji team.
The question is published on by Tutorial Guruji team.
I am using only http service and I dont want to pay SSL certificate and don’t use self signed certificate. there is any other way to get send push notification in my app clients. Thanks in advance.
Answer
See the Link. I hope it will helps you. You should disable your server ssl then send push notification. use below link for refer. 1)code for client 2)add this code for server.
1) http://javapapers.com/android/google-cloud-messaging-gcm-for-android-and-push-notifications/ 2) http://www.nakov.com/blog/2009/07/16/disable-certificate-validation-in-java-ssl-connections/
public static void main(String[] args) throws Exception { // Create a trust manager that does not validate certificate chains TrustManager[] trustAllCerts = new TrustManager[] {new X509TrustManager() { public java.security.cert.X509Certificate[] getAcceptedIssuers() { return null; } public void checkClientTrusted(X509Certificate[] certs, String authType) { } public void checkServerTrusted(X509Certificate[] certs, String authType) { } } }; // Install the all-trusting trust manager SSLContext sc = SSLContext.getInstance("SSL"); sc.init(null, trustAllCerts, new java.security.SecureRandom()); HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); // Create all-trusting host name verifier HostnameVerifier allHostsValid = new HostnameVerifier() { public boolean verify(String hostname, SSLSession session) { return true; } }; // Install the all-trusting host verifier HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid); URL url = new URL("https://www.nakov.com:2083/"); URLConnection con = url.openConnection(); Reader reader = new InputStreamReader(con.getInputStream()); while (true) { int ch = reader.read(); if (ch==-1) { break; } System.out.print((char)ch); } }
We are here to answer your question about How to send android push notification without ssl certificate - If you find the proper solution, please don't forgot to share this with your team members.