BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 01-26-2012, 01:12 PM   #1 (permalink)
New Member
 
Join Date: Jan 2012
Model: 8520
PIN: N/A
Carrier: -
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Help with Blackberry and Twitter integration

Please Login to Remove!

Im developing an application that should to be able to share contents to twitter, and i cant get OAuth to work.
Im trying with the library twitter_api_me-1.8.jar and the example TwitterAPIME-RIM-OAuthSample.

The problem i think is in the callback, because im able to open the twitter login page and login, but after that i dont know how to get back to the application, and the method public void onAuthorize(Token token) is never invoked.


Ive been searching this in google and i found that a lot of people had the same problem, but unfortunately i didnt find any solution.

Thanks to all.


Here is my source code:
package com.twitterapime.oauth;

import impl.rim.com.twitterapime.xauth.ui.BrowserContentM anagerOAuthDialogWrapper;
import net.rim.device.api.browser.field.BrowserContentMan ager;
import net.rim.device.api.browser.field.RenderingOptions;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.container.MainScreen;

import com.twitterapime.rest.Credential;
import com.twitterapime.rest.TweetER;
import com.twitterapime.rest.UserAccountManager;
import com.twitterapime.search.Tweet;
import com.twitterapime.xauth.Token;
import com.twitterapime.xauth.ui.OAuthDialogListener;
import com.twitterapime.xauth.ui.OAuthDialogWrapper;

public class TwitterAPIMERIMOauthSample extends UiApplication {
/**
* @param args
*/
public static void main(String[] args) {
TwitterAPIMERIMOauthSample app = new TwitterAPIMERIMOauthSample();
app.enterEventDispatcher();
}

/**
*
*/
public TwitterAPIMERIMOauthSample() {
pushScreen(new BrowserFieldScreen());
}
}

/**
*/
class BrowserFieldScreen extends MainScreen{
/**
*
*/
private final String CONSUMER_KEY = "<consumer key>";

/**
*
*/
private final String CONSUMER_SECRET = "<consumer secret>";

/**
*
*/
public static final String CALLBACK_URL= "";

/**
*
*/
public BrowserFieldScreen() {
setTitle("Twitter API ME - OAuth");
BrowserContentManager browserMngr = new BrowserContentManager(0);
RenderingOptions rendOptions = browserMngr.getRenderingSession().getRenderingOpti ons();
rendOptions.setProperty(
RenderingOptions.CORE_OPTIONS_GUID,
RenderingOptions.SHOW_IMAGES_IN_HTML,
false);
//
add(browserMngr);
//
OAuthDialogWrapper pageWrapper =
new BrowserContentManagerOAuthDialogWrapper(browserMng r);
//
pageWrapper.setConsumerKey(CONSUMER_KEY);
pageWrapper.setConsumerSecret(CONSUMER_SECRET);
pageWrapper.setCallbackUrl(CALLBACK_URL);
pageWrapper.setOAuthListener(new OAuthDialogListener() {

public void onAuthorize(Token token) {
Credential c = new Credential(CONSUMER_KEY, CONSUMER_SECRET, token);
UserAccountManager uam = UserAccountManager.getInstance(c);
//
try {
if (uam.verifyCredential()) {
TweetER.getInstance(uam).post(new Tweet("test: " + System.currentTimeMillis()));
//
System.out.println("Tweet posted!");
}
} catch (Exception e) {
System.out.println("Error by posting tweet.");
}
}

/**
* @see com.twitterapime.xauth.ui.OAuthDialogListener#onAc cessDenied(java.lang.String)
*/
public void onAccessDenied(String message) {
System.out.println("Access denied!");
}

/**
* @see com.twitterapime.xauth.ui.OAuthDialogListener#onFa il(java.lang.String,
* java.lang.String)
*/
public void onFail(String error, String message) {
System.out.println("Error by authenticating user!");
}

});
//
pageWrapper.login();
}

}

Last edited by kelospario : 01-26-2012 at 01:14 PM.
Offline  
Old 05-31-2012, 12:13 AM   #2 (permalink)
New Member
 
Join Date: May 2012
Model: 9800
PIN: N/A
Carrier: vodaphone
Posts: 1
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: Help with Blackberry and Twitter integration

I'm also getting same problem, getting twitter login page, after sucessfull login its display pin number, after that what i have to do, dont know, where i've to used that pin number, no idea, i have searched alot on google, but didn't find out any solution yet, If anyone solved out please hepls me also, it would be appericated.

Thnaks
Ajay
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads for: Help with Blackberry and Twitter integration
Thread Thread Starter Forum Replies Last Post
BlackBerry Curve 3G Multiple Issues iAmJuanKarlo BlackBerry Help 2 04-03-2011 10:59 AM
HTV EVO & Blackberry Bold 9650 - my experience yahtzee BlackBerry Versus 5 01-10-2011 02:48 PM
New Blackberry Torch Announced tsac General 9800 Series Discussion - Torch 4 08-03-2010 02:43 PM
What's the new and best software for Storm 9530??? John1300 General 9500 Series Discussion - Storm 55 04-09-2009 08:33 PM





Copyright © 2004-2014 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.