Skip to content

Instantly share code, notes, and snippets.

View evernotegists's full-sized avatar

Evernote Gists evernotegists

  • Evernote Corporation
  • Redwood City, CA
View GitHub Profile
EvernoteSession mEvernoteSession = EvernoteSession.getInstance(this, CONSUMER_KEY, CONSUMER_SECRET, EVERNOTE_SERVICE);
mEvernoteSession.authenticate(this);
AsyncNoteStoreClient asyncNoteStore = mEvernoteSession.getClientFactory().createNoteStoreClient();
public void createNote(String title, String content) throws TTransportException {
if (mEvernoteSession.isLoggedIn()) {
Note note = new Note();
note.setTitle(title);
note.setContent(EvernoteUtil.NOTE_PREFIX + content + EvernoteUtil.NOTE_SUFFIX);
mEvernoteSession.getClientFactory().createNoteStoreClient().createNote(note, new OnClientCallback<Note>() {
@Override
public void onSuccess(final Note data) {
Toast.makeText(getApplicationContext(), data.getTitle() + " has been created", Toast.LENGTH_LONG).show();
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
BOOL canHandle = NO;
if ([[NSString stringWithFormat:@"en-%@", [[EvernoteSession sharedSession] consumerKey]] isEqualToString:[url scheme]] == YES) {
canHandle = [[EvernoteSession sharedSession] canHandleOpenURL:url];
}
return canHandle;
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
[[EvernoteSession sharedSession] handleDidBecomeActive];
}
<uses-permission android:name="android.permission.INTERNET" />
<activity android:name="com.evernote.client.android.EvernoteOAuthActivity"
android:configChanges="orientation|keyboardHidden" />
try {
mEvernoteSession.getClientFactory().createUserStoreClient().getUser(
new OnClientCallback<User>() {
@Override
public void onSuccess(User user){
Log.v(LOGTAG, "User: "+user.getUsername());
}
@Override
public void onException(Exception exception) {
String authToken = mEvernoteSession.getAuthToken();
// getUser() must be run on a separate thread
User user = mEvernoteSession.getClientFactory().createUserStoreClient().getClient().getUser(authToken);