Ya i got you. May be i got you wrong plus there are not much android
experienced developers who like to encourage beginners
out there. Anyways treking i have done some google search and i have reached
a safe stage where i am directing my app to OAUTH login page and when the
user logs in he is directed back to my application but now i dont know how
to update its twitter status?
Should i do that in onResume?
The following are the steps i followed :-


   - I added signpost core and signpost commonshttp4 jar files in assets
   folder
   - then i added them in build path
   - Then in my main java file i declare following constants before
   oncreate

private static final String CONSUMER_KEY = "EuMduRyU4fJcaVgPuN9vA";
    private static final String CONSUMER_SECRET =
"JsiDIvPTPhxcV7NgYkw5HVDO0HC41eI2A8ELVLwqqRU";

    private static String ACCESS_KEY = null;
    private static String ACCESS_SECRET = null;


    private static final String REQUEST_URL = "
http://twitter.com/oauth/request_token";;
    private static final String ACCESS_TOKEN_URL = "
http://twitter.com/oauth/access_token";;
    private static final String AUTH_URL = "
http://twitter.com/oauth/authorize";;
    private static final String CALLBACK_URL = "myTweet://twitt";
    private static final String PREFERENCE_FILE = "twitter_oauth.prefs";

    private static CommonsHttpOAuthConsumer consumer = new
CommonsHttpOAuthConsumer(
    CONSUMER_KEY, CONSUMER_SECRET);
    private static CommonsHttpOAuthProvider provider = new
CommonsHttpOAuthProvider(
    REQUEST_URL, ACCESS_TOKEN_URL, AUTH_URL);

   - In oncreate i created an onclick listener with the following code :-

    try {
                     String authURL = provider.retrieveRequestToken(
            consumer, CALLBACK_URL);

            Log.d("OAuthTwitter", authURL);
            startActivity(new Intent(Intent.ACTION_VIEW, Uri
            .parse(authURL)));
                } catch (OAuthMessageSignerException e) {
            e.printStackTrace();
                } catch (OAuthNotAuthorizedException e) {
            e.printStackTrace();
                } catch (OAuthExpectationFailedException e) {
            e.printStackTrace();
                } catch (OAuthCommunicationException e) {
            e.printStackTrace();
                }
            }

   - Till now the code is going all well and now i create onResume with the
   following code


        super.onResume();
        Uri uri = this.getIntent().getData();

        if (uri != null && uri.toString().startsWith(CALLBACK_URL)) {
        Log.d("OAuthTwitter", uri.toString());
        String verifier = uri.getQueryParameter(OAuth.OAUTH_VERIFIER);
        Log.d("OAuthTwitter", verifier);
        try {

        provider.retrieveAccessToken(consumer, verifier);
        ACCESS_KEY = consumer.getToken();
        ACCESS_SECRET = consumer.getTokenSecret();

        Log.d("OAuthTwitter", ACCESS_KEY);
        Log.d("OAuthTwitter", ACCESS_SECRET);

        } catch (OAuthMessageSignerException e) {
        e.printStackTrace();
        } catch (OAuthNotAuthorizedException e) {
        e.printStackTrace();
        } catch (OAuthExpectationFailedException e) {
        e.printStackTrace();
        } catch (OAuthCommunicationException e) {
        e.printStackTrace();
        }
        }

Please tell me where and what should i write now to update the status. I am
updating the status through code and not asking it from user . I think there
is some token involved so may be i would have to store it also. Anyways
please revert back if you have any solution for me i hope i made everything
clear this time :)

On Sat, Feb 5, 2011 at 10:27 PM, TreKing <treking...@gmail.com> wrote:

> On Sat, Feb 5, 2011 at 1:34 AM, Robin Talwar <r.o.b.i.n.abhis...@gmail.com
> > wrote:
>
>> Sorry i have read your other posts also
>> you keep replying in the same tone anyways
>>
>
> It is very difficult to convey tone in emails / posts. Tone is usually
> inferred by the reader. This perceived tone is often wrong.
>
>
>> my bad i dint mention my post like :-
>>
>> For Treking  :  *Do you have any reference twitter sharing android
>> tutorial??*
>>
>
> There you go, that's more like it. See how clear and to that point that is?
> But there is no reason to reserve that kind of detail specifically for me -
> everyone would benefit.
>
>
>> For rest of the world  :
>>
>
> The rest of the world would still have no idea that you're looking for
> tutorials because, for the fourth time now, *you did not specify that in
> your original post*.
>
> I am simply trying to express to you the fact that when posting in this
> forum or any forum you need to be clear if you expect to get a good answer.
> "I want to share via twitter, I have facebook, now I need the same for
> twitter" in NO WAY implies that your problem is that you couldn't find a
> good tutorial on the subject.
>
> Your perception of my tone aside, do you understand what I'm trying to tell
> you?
>
>
> -------------------------------------------------------------------------------------------------
> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> transit tracking app for Android-powered devices
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to