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
EvernoteSession mEvernoteSession = EvernoteSession.getInstance(this, CONSUMER_KEY, CONSUMER_SECRET, EVERNOTE_SERVICE); |
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
mEvernoteSession.authenticate(this); |
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
AsyncNoteStoreClient asyncNoteStore = mEvernoteSession.getClientFactory().createNoteStoreClient(); |
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 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(); | |
} |
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
- (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; | |
} |
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
- (void)applicationDidBecomeActive:(UIApplication *)application | |
{ | |
[[EvernoteSession sharedSession] handleDidBecomeActive]; | |
} |
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
<uses-permission android:name="android.permission.INTERNET" /> |
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
<activity android:name="com.evernote.client.android.EvernoteOAuthActivity" | |
android:configChanges="orientation|keyboardHidden" /> |
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 { | |
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) { |
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
String authToken = mEvernoteSession.getAuthToken(); | |
// getUser() must be run on a separate thread | |
User user = mEvernoteSession.getClientFactory().createUserStoreClient().getClient().getUser(authToken); |