Blackberry Twitter App using oAuth and TWITTER API ME 1.8 Library -


i building twitter app bb connects twitter , posts on users behalf. using twitter api me 1.8 library , oauth authentication method. here code:

    class showauthbrowser extends mainscreen implements oauthdialoglistener {     browserfield b = new browserfield();      public showauthbrowser() {          _authmanager = new verticalfieldmanager(no_vertical_scroll                 | no_vertical_scrollbar);         _pinmanager = new horizontalfieldmanager(no_vertical_scroll                 | no_vertical_scrollbar);         authbutton = new buttonfield("ok");         authpin = new textfield(field.editable);         _labelstatus = new labelfield("your app being authorized...");         _authmanager.add(_labelstatus);         _authmanager.add(b);          _pinmanager.add(authbutton);         _pinmanager.add(authpin);          pagewrapper = new browserfieldoauthdialogwrapper(b, consumer_key,                 consumer_secret, callback_url, this);          pagewrapper.setoauthlistener(this);          add(_pinmanager);         add(_authmanager);          authbutton.setchangelistener( new fieldchangelistener( ) {             public void fieldchanged( field field, int context ) {                 if( field == authbutton ) {                        doauth(authpin.gettext());                 }             }         } );     }      public void doauth(string pin) {         try {             if (pin == null) {                 pagewrapper.login();             } else {                 this.deleteall();                 add(b);                 pagewrapper.login(pin);             }          } catch (exception e) {             final string message = "error loggin twitter: "                     + e.getmessage();             dialog.alert(message);          }     }      public void onaccessdenied(string response) {          system.out.println("access denied! -> " + response);         updatescreenlog("acceso denegado! -> " + response);      }      public void onauthorize(final token token) {          system.out.println("in authorize: "+token);         final token mytoken = token;         _tokenvalue = storetoken.fetch();         _tokenvalue.token = mytoken.gettoken();         _tokenvalue.secret = mytoken.getsecret();         _tokenvalue.userid = mytoken.getuserid();         _tokenvalue.username = mytoken.getusername();         _tokenvalue.save();          uiapplication.getuiapplication().invokelater(new runnable() {              public void run() {                 deleteall();                 credential c = new credential(consumer_key,                         consumer_secret, mytoken);                 tweettofriend tw = new tweettofriend();                 string message = "test tweet...";                 boolean done = false;                 done = tw.dotweet(message, c);                 if (done == true) {                     dialog.alert("tweet succusfully...");                     close();                 }             }         });      }      public void onfail(string arg0, string arg1) {         updatescreenlog("error authenticating user! -> " + arg0 + ", "                 + arg1);     } }  private void updatescreenlog(final string message) {     uiapplication.getuiapplication().invokelater(new runnable() {          public void run() {             _labelstatus.settext(message);         }     }); } 

here onauthorize() never getting called, instead onfail() called everytime , oauth_io_exception, general socket error thrown.

can please me out.

thanks.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -