1

Yahoo API for Android application

Hi 

I am thinking about using YAHOO APi for a new app that I am developing in Android.

Is this possible?

Is there any limitations that I should be aware of?

Thanks in advance 
Ari

by
31 Replies
  •   /** Called when the activity is first created. */
        @SuppressWarnings("static-access")
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);

            try {

                consumer = new CommonsHttpOAuthConsumer(YAHOO_CONSUMER_KEY,
                        YAHOO_CONSUMER_SECRET);
                //consumer.setMessageSigner(new HmacSha1MessageSigner());
                provider = new CommonsHttpOAuthProvider(YAHOO_REQUEST_URL,
                        YAHOO_ACCESS_URL,YAHOO_AUTHORIZE_URL);
               
                provider.setOAuth10a(true);
            } catch (Exception e) {
                e.printStackTrace();
            }

            getRequestToken();
           
           

        }
       
      
    1
  • private void getRequestToken() {
            try {
               
                String url = provider.retrieveRequestToken(consumer,YAHOO_OAUTH_CALLBACK_URL);
                Log.e("URL",url);
                Intent intent = 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(intent);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
       
        @Override
        public void onNewIntent(Intent intent) {
            super.onNewIntent(intent);
            prefs = PreferenceManager.getDefaultSharedPreferences(this);
            final Uri uri = intent.getData();
            if (uri != null && uri.getScheme().equals(YAHOO_OAUTH_CALLBACK_SCHEME)) {
                getAccessToken(uri);
            }
       
        }
       
    -1

  •     private void getAccessToken(Uri uri) {
            final String oauth_verifier = uri.getQueryParameter(OAuth.OAUTH_VERIFIER);
            try {
                provider.setOAuth10a(true);
                provider.retrieveAccessToken(consumer, oauth_verifier);
                final Editor edit = prefs.edit();
                edit.putString(YAHOO_OAUTH_TOKEN, consumer.getToken());
                edit.putString(YAHOO_OAUTH_TOKEN_SECRET, consumer.getTokenSecret());
                edit.commit();
                String token = prefs.getString(YAHOO_OAUTH_TOKEN, "");         My tokens
                String secret = prefs.getString(YAHOO_OAUTH_TOKEN_SECRET, "");
                HttpParameters params= new HttpParameters();
                params=consumer.getRequestParameters();
                params.values().toString();
                Log.e("pharmeters",params.values().toString());
                Log.e("Token",token);
                Log.e("Secret Token",secret);
               
                consumer.setTokenWithSecret(token, secret);
               
                RestInvoke rest= new RestInvoke();
               
             
    0
  •   try {
                    rest.invoke("http://social.yahooapis.com/v1/me/guid");

                    Here im trying to get my contacts with an HttpClient request

                    But the massage that im geting is this:

                        >Please provide valid credentials. OAuth oauth_problem="unable_to_determine_oauth_type", realm="yahooapis.com"</yahoo:description></yahoo:error><!-- ws110.socdir.ch1.yahoo.com uncompressed/chunked
                       
                } catch (Exception e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
               
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

    What am i doing wrong ?!
    PLS someone from Yahoo! or somebody pls help me :)
    THX !
    0
  • private void getAccessToken(Uri uri) {
            final String oauth_verifier = uri.getQueryParameter(OAuth.OAUTH_VERIFIER);
            try {
                provider.setOAuth10a(true);
                provider.retrieveAccessToken(consumer, oauth_verifier);
               
               

                final Editor edit = prefs.edit();
                edit.putString(YAHOO_OAUTH_TOKEN, consumer.getToken());
               
                edit.putString(YAHOO_OAUTH_TOKEN_SECRET, consumer.getTokenSecret());
                edit.commit();
               
               
            
    0
  •    String token = prefs.getString(YAHOO_OAUTH_TOKEN, "");
                String secret = prefs.getString(YAHOO_OAUTH_TOKEN_SECRET, "");
               
                HttpParameters params= new HttpParameters();
                params=consumer.getRequestParameters();
                params.values().toString();
                Log.e("pharmeters",params.values().toString());
                Log.e("Token",token);
                Log.e("Secret Token",secret);
               
                consumer.setTokenWithSecret(token, secret);
               
                RestInvoke rest= new RestInvoke();
               
                try {
                    rest.invoke("http://social.yahooapis.com/v1/me/guid");
                   
                    Here i'm calling the httpClient request. For the response i get an error :
                   
                    Please provide valid credentials. OAuth oauth_problem="unable_to_determine_oauth_type", realm="yahooapis.com"</yahoo:description></yahoo:error><!-- ws101.socdir.ch1.yahoo.com uncompressed/chunked

                } catch (Exception e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
               
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

    What am i doing wrong ?
    PLs help me thx !
    0
  • Can you send me your source ? i can review it clear ly , my email : jay_kidzzzz@yahoo.com
    0
  • send me the code i will post myupdated code to you

    my mail id is  ksrikanthreddi@yahoo.com
    0
  • send me this code at usman_riaz360@yahoo.com

    0
  • hi! send me code at tech_aamri@yahoo.in thanks!!

    0
  • hi! send me code at tech_aamir@yahoo.in thanks!!

    0
  • Hello! could you please send me your code? s9013xx@hotmail.com Thanks you very much! Thanks!

    0
  • Hi, Can u please send source code to my email id vsam1122@yahoo.com

    Thanks...

    0
  • hii cna u plz send me the source code?i hv to implement this.nd i donw know how to get live data of stock market in android?my email id: neel589@gmail.com

    0
  • Would you please send me the complete source code. rai.tejani117@gmail.com

    0
  • Would you please send me the complete source code. Thanks! id: rai.tejani117@gmail.com

    0
  • Hello, Would you please send me the source code on my email. thanks, emailid : pinkald.mistry@gmail.com

    0
  • Hi, can you please send me this code? Gump47371@Gmail.com

    Thanks!

    0
  • Hi , would you please send me the complete source code to imran_it06004@yahoo.com

    0
  • Hi,

    Can you pls send me complete source code to maryshebin_kj@yahoo.com

    0
  • can u please send me source code to thi id raza_1721@yahoo.com

    0
  • Hi,

    Please send me the code also: suncowiam@yahoo.com

    Thanks!

    0
  • please send me code thanks in advance my Email is ==> skumar@objectsol.in

    0
  • Hi, Can you pls send me complete source code to aswathy@yubi.in

    Thanks!

    0
  • Hi, Can you pls send me complete source code to zong779@yahoo.com Thanks!

    0
  • Hi, i need this code also, please email me at usmansaleem25@gmail.com

    0
  • Hi, can u send me the source code to ensisinfodevice1@gmail.com

    0
  • Hi, can you send me the code, my email: ngocht143@gmail.com

    0
  • Hi, Can you pls send me complete source code to rahul_rana5790@yahoo.in Thanks!

    0
  • Hi,please send me the complete source code to my mail ids---kondasurendar@yahoo.com<,kondasurendar@gmail.com>,i am trying to develop sports update app by using yahoo sports api in android so please help me... Thanks in advance

    0
  • Türkiye de ve Avrupa da İlk ve Tek Profesyonel Bioenerji Eğitimi...Metafizik uzmanı ve psikanalist-yazar Gökhan Hani'nin 10 yıl süren Profesyonel eğitim işleyişine uygun olarak 2 gün 14 saatlik eğitim proğramlarıyla birebir olarak verilmektedir.İki sertifikalı olarak verilen bioenerji eğitimleri için aşağıdaki numaralardan randevu alabilirsiniz. Taklitlerimizden sakının. TEL.0216 449 4561 939 0123 http://www.metafizikakademi.comwww.metafizikuzmani.comwww.metafizikci.com

    0

Recent Posts

in Fantasy Sports API