c0debrain / socialauth

Automatically exported from code.google.com/p/socialauth
0 stars 0 forks source link

fix back compatibility issue for android 2.2 and pre #252

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
i found the problem was in ssl in socialauth-core so if we added reference to 
any android.jar and then replaced the code in HttpUtil 
static {
        SSLContext ctx;
try
{
ctx = SSLContext.getInstance("TLS");
            ctx.init(new KeyManager[0],
                    new TrustManager[] { new DefaultTrustManager() },
                    new SecureRandom());
            SSLContext.setDefault(ctx);
        }
        catch (Exception ex) {

            ex.printStackTrace();
        }
    }
with this code it will work on any android
static {
        SSLContext ctx;
        try {
            if (Build.VERSION.SDK_INT <10)
                {
                ctx = SSLContext.getInstance("TLS");
                ctx.init(null, new TrustManager[] {
                  new X509TrustManager() {
                    public void checkClientTrusted(X509Certificate[] chain, String authType) {}
                    public void checkServerTrusted(X509Certificate[] chain, String authType) {}
                    public X509Certificate[] getAcceptedIssuers() { return new X509Certificate[]{}; }
                  }
                }, null);
                HttpsURLConnection.setDefaultSSLSocketFactory(ctx.getSocketFactory());
                HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {

                    @Override
                    public boolean verify(String arg0, SSLSession arg1) {
                        // TODO Auto-generated method stub
                        return true;
                    }

                    });
                }else{
            ctx = SSLContext.getInstance("TLS");
            ctx.init(new KeyManager[0],
                    new TrustManager[] { new DefaultTrustManager() },
                    new SecureRandom());
            SSLContext.setDefault(ctx);
                }
        }
        catch (Exception ex) {

            ex.printStackTrace();
        }
    }

Original issue reported on code.google.com by mazzi...@gmail.com on 4 Mar 2013 at 1:11

GoogleCodeExporter commented 9 years ago
Thanks for this wonderful suggestion and providing this patch.

We have added support for android2.2, but in different way without including 
jar. Code has been committed in SVN, so you can have a look and let me know if 
you find any issue in this to run it on android 2.2.

Regards
Tarun

Original comment by tarun.na...@3pillarglobal.com on 7 Mar 2013 at 9:45

GoogleCodeExporter commented 9 years ago
thanks for your response i will try it and come back to you if any thing else 
faced me.

Original comment by mazzi...@gmail.com on 7 Mar 2013 at 12:28

GoogleCodeExporter commented 9 years ago
I have runed it on android 2.2 ..still its giving a runtime error No class def 
found for social auth adapter..It is pointing in my code :

//adapter = new SocialAuthAdapter(new ResponseListener());

In error log its showing like :

07-21 23:05:37.911: E/AndroidRuntime(17314): java.lang.NoClassDefFoundError: 
org.brickred.socialauth.android.SocialAuthAdapter

Original comment by arnab.cr...@gmail.com on 21 Jul 2013 at 5:41

GoogleCodeExporter commented 9 years ago
I was using social auth 2.5 it was ok..I got a new update..2.6 I added the 
external jar suddenly my programme started showing some error..once I resolved 
those .I tried running the programme but still its giving error..Dono what have 
I done wrong with my code

Original comment by arnab.cr...@gmail.com on 21 Jul 2013 at 5:50

GoogleCodeExporter commented 9 years ago
Hi Arnab

Please open a issue on http://code.google.com/p/socialauth-android/ for android 
support.

Original comment by tarun.na...@3pillarglobal.com on 23 Jul 2013 at 11:55