BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 01-26-2012, 02:12 PM   #1
kelospario
New Member
 
Join Date: Jan 2012
Model: 8520
PIN: N/A
Carrier: -
Posts: 1
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 02:14 PM..
Offline  
Old 05-31-2012, 12:13 AM   #2
erAjayGoyal
New Member
 
Join Date: May 2012
Model: 9800
PIN: N/A
Carrier: vodaphone
Posts: 1
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



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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 03: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


Portable Voice Amplifier, Towevine Rechargeable Microphone Speaker picture

Portable Voice Amplifier, Towevine Rechargeable Microphone Speaker

$14.99



BJ300 Plus BJ300Plus 3-30MHz Radio Power Amplifier +Fan FM 100W AM 200W SSB 300W picture

BJ300 Plus BJ300Plus 3-30MHz Radio Power Amplifier +Fan FM 100W AM 200W SSB 300W

$104.49



Lab-Volt 91006-20 Transistor Amplifier Circuits Board Training Module By Festo picture

Lab-Volt 91006-20 Transistor Amplifier Circuits Board Training Module By Festo

$110.00



BOGEN COMMUNICATION 30W Digital Switching Amp Horn Self-Amplified Speaker SAH30 picture

BOGEN COMMUNICATION 30W Digital Switching Amp Horn Self-Amplified Speaker SAH30

$129.99



ResponseBridge M801 Black Bluetooth 5.0 Voice Amplifier W/ Wireless Mic Headset picture

ResponseBridge M801 Black Bluetooth 5.0 Voice Amplifier W/ Wireless Mic Headset

$99.99



New In Box ATOS E-MI-AS-IR Proportional Amplifier picture

New In Box ATOS E-MI-AS-IR Proportional Amplifier

$302.12







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