This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
QBAuth.createSession(new QBCallbackImpl() { | |
@Override | |
public void onComplete(Result result) { | |
// result comes here | |
// check if result success | |
if (result.isSuccess()) { | |
// do stuff you need | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Post message to Twitter | |
*/ | |
private boolean postTwitt(UserAccountManager _userAccMan, String _message) { | |
try { | |
Tweet uT = new Tweet(_message); | |
TweetER tTR = TweetER.getInstance(_userAccMan); | |
tTR.post(uT); | |
return true; | |
} catch (IllegalArgumentException iAE) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TwitterQBAuth implements QBHTTPAnswerListener | |
{ | |
private String TOKEN = ""; | |
private String timestamp = ""; | |
private String BROWSER_SESSION = ""; | |
private String TWITTER_AUTH_URL = ""; | |
private final String QB_APP_ID = "341"; | |
private final String QB_AUTH_KEY = "nhsOHKDNqwvpuDV"; | |
private final String QB_AUTH_SECRET = "evPuQba3jC3Q6AX"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TwitterAuthScreen extends MainScreen implements Constants | |
{ | |
private TwitterAuthScreen me; | |
private BrowserField browserField; | |
private ProtocolController protocolController; | |
private BrowserFieldErrorHandler browserFieldErrorHandler; | |
private BrowserFieldConfig browserFieldConfig = new BrowserFieldConfig(); | |
private String twitterCookie = ""; | |
private String twittwerAuthURL = ""; | |
private TwitterPoster twitterPoster = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// make query | |
long timestamp = System.currentTimeMillis()/1000; | |
int nonce = new Random().nextInt(); | |
String signatureParams = String.format("application_id=%s&auth_key=%s&nonce=%s×tamp=%s&user[login]=%s&user[password]=%s", | |
QBQueries.APPLICATION_ID, QBQueries.AUTH_KEY, nonce, timestamp, "test", "test"); | |
String signature = null; | |
try { | |
signature = Signature.calculateHMAC_SHA(signatureParams, QBQueries.AUTH_SECRET); | |
} catch (SignatureException e) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.crypto.Mac; | |
import javax.crypto.spec.SecretKeySpec; | |
import java.security.SignatureException; | |
/** | |
* @author Igor Khomenko | |
* injoit.com | |
* | |
* This class defines common routines for generating |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
PushNotificationsStorage.getInstance().removePushNotification(pNO); | |
onClose(); | |
} catch (Exception ex) { | |
System.out.println("removePushNotification exception = " + ex); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LabelField pushressievedLabel = new LabelField("Message ressieved on:") { | |
public void paint(Graphics g) { | |
g.setColor(0xffffff); | |
super.paint(g); | |
} | |
}; | |
pushressievedLabel.setPadding(5, 5, 0, 5); | |
pushressievedLabel.setFont(pushressievedLabel.getFont().derive(Font.BOLD)); | |
add(pushressievedLabel); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
System.out.println("----- Successfullly UNSUBSCRIBED FROM PUSH"); | |
// Push Notification ON = 0 | |
// Push Notification OFF = 1 | |
OptionStorage.getInstance().getOption("Push notifications").setCurrentValueIndex(1); | |
} catch (Exception ex) { | |
DebugStorage.getInstance().Log(0, "<UnsubscribeQbPush> ProcessAnswer | |
REQUEST_PUSH_UNSUBSCRIBE ", ex); | |
} | |
break; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
System.out.println("----- Successfully subsribed on Push notifications"); | |
// Push Notification ON = 0 | |
// Push Notification OFF = 1 | |
OptionStorage.getInstance().getOption("Push notifications").setCurrentValueIndex(0); | |
} catch (Exception ex) { | |
DebugStorage.getInstance().Log(0, "<PushQbAuth> ProcessAnswer REQUEST_PUSH_SUBSCRIBE | |
Exception ", ex); | |
} | |
break; |