java - How to do yahoo integration in Android? -


i'm developing yahoo login integration in android app , return main activity. have completed steps of yahoo integration.i have spent several days searching yahoo integration in android cant find proper way.when run code , proper sign in yahoo email , when click agree button comes call_back url. please can mi.here code

public class requesttokaenactivity2 extends activity {     private oauthconsumer consumer;     private oauthprovider provider;     private sharedpreferences yahooprefs;     private commonshttpoauthconsumer myconsumer;     private commonshttpoauthprovider myprovider;     private string requesttoken;     private string accesstoken;      public void oncreate(bundle savedinstancestate)     {         super.oncreate(savedinstancestate);          try         {             consumer=new commonshttpoauthconsumer(c1.consumer_key,c1.consumer_secret);              consumer.setmessagesigner(new hmacsha1messagesigner());             httpclient httpcliet=new defaulthttpclient();               provider=new commonshttpoauthprovider(c1.request_url,c1.access_url,c1.authorize_url,httpcliet);             provider.setoauth10a(true);             string strurl=provider.retrieverequesttoken(consumer,c1.oauth_callback_url);             requesttoken=consumer.gettoken();             startactivity(new intent(intent.action_view,uri.parse(strurl)));          }          catch(exception ex)         {             toast.maketext(getapplicationcontext(),ex.getmessage(),toast.length_long).show();             log.e(ex.getmessage(), ex.tostring());          }        }      @override      public void onnewintent(intent intent)     {         super.onnewintent(intent);         yahooprefs=preferencemanager.getdefaultsharedpreferences(getbasecontext());         final uri uri=intent.getdata();          if(uri!=null && uri.getscheme().equals(c1.oauth_callback_scheme))         {             log.i(c1.tag, "callback received : " + uri);             log.i(c1.tag, "retrieving access token");             getaccesstoken(uri);         }      }       private void getrequesttoken()     {         try         {             string url=provider.retrieverequesttoken(consumer, c1.oauth_callback_url);             intent i=new intent(intent.action_view , uri.parse(url)).setflags(intent.flag_activity_single_top | intent.flag_activity_no_history | intent.flag_from_background );             this.startactivity(i);           }         catch(exception e1)         {             e1.printstacktrace();             log.e(c1.tag, "error retrieving request token", e1);         }     }      private void getaccesstoken(uri uri)     {          final string oauthverifier=uri.getqueryparameter(oauth.oauth_verifier);         final editor edit=yahooprefs.edit();         edit.putstring(oauth.oauth_token,consumer.gettoken());         edit.putstring(oauth.oauth_token_secret,consumer.gettokensecret());         edit.commit();          string token=yahooprefs.getstring(oauth.oauth_token, "");         string secret=yahooprefs.getstring(oauth.oauth_token_secret,"");          consumer.settokenwithsecret(token, secret);         this.startactivity(new intent(this,oauthmain.class));         log.i(c1.tag, "access token retrieved");      }  }         public class c1      {         public static final string consumer_key     = "xxxxxxxxxx";         public static final string consumer_secret  = "xxxxxxxxxx";           public static final string scope            = "http://social.yahooapis.com/v1/user/";          public static final string request_url      = "https://api.login.yahoo.com/oauth/v2/get_request_token";          //https://api.login.yahoo.com/oauth/v2/          public static final string access_url       = "https://api.login.yahoo.com/oauth/v2/get_access_token";          //https://api.login.yahoo.com/oauth/v2/get_token"          public static final string authorize_url    = "https://api.login.yahoo.com/oauth/v2/request_auth";         //https://api.login.yahoo.com/oauth/v2/request_auth"         //public static final string unauthorize_url  = "https://accounts.google.com/o/oauth2/revoke";          public static final string get_contacts_from_yahoo_request="http://social.yahooapis.com/v1/user/{guid}/contacts";          public static final string encoding = "utf-8";          public static final string  oauth_callback_scheme   = "http";         public static final string  oauth_callback_host     = "www.bcod.co.in";         public static final string  oauth_callback_url      = oauth_callback_scheme + "://" + oauth_callback_host;         public static final string  app_name                = "demo_oauth1";         public static final string  tag = null;      } 


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -