I wish to access HTTPS mapservices with self signed certificate. When I tried to do this it fails.
I tried to call the code below to be able to accept any certificate in andriod but this does not help.

private void trustEveryone() {
try {
.setDefaultHostnameVerifier(new HostnameVerifier() {
public boolean verify(String hostname,
SSLSession session) {
return true;
SSLContext context = SSLContext.getInstance("TLS");
context.init(null, new X509TrustManager[] { new X509TrustManager() {
public void checkClientTrusted(X509Certificate[] chain,
String authType) throws CertificateException {

public void checkServerTrusted(X509Certificate[] chain,
String authType) throws CertificateException {

public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
} }, new SecureRandom());
} catch (Exception e) { // should never happen

If anyone has a solution to this please let me know.

Thanks in advance.

Dinesh Mathur