{"id":20569675,"url":"https://github.com/evernote/evernote-sdk-android","last_synced_at":"2025-04-13T00:46:38.515Z","repository":{"id":3102928,"uuid":"4128628","full_name":"Evernote/evernote-sdk-android","owner":"Evernote","description":"Evernote SDK for Android","archived":false,"fork":false,"pushed_at":"2023-06-02T14:55:53.000Z","size":10885,"stargazers_count":430,"open_issues_count":24,"forks_count":167,"subscribers_count":59,"default_branch":"master","last_synced_at":"2025-04-13T00:46:31.318Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Evernote.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2012-04-24T19:14:31.000Z","updated_at":"2024-12-02T00:54:28.000Z","dependencies_parsed_at":"2022-08-01T00:48:18.710Z","dependency_job_id":"f103bb9d-08be-48ab-b677-40c36429ba95","html_url":"https://github.com/Evernote/evernote-sdk-android","commit_stats":{"total_commits":175,"total_committers":12,"mean_commits":"14.583333333333334","dds":0.5542857142857143,"last_synced_commit":"fc59be643e85c4f59d562d1bfe76563997aa73cf"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Evernote%2Fevernote-sdk-android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Evernote%2Fevernote-sdk-android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Evernote%2Fevernote-sdk-android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Evernote%2Fevernote-sdk-android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Evernote","download_url":"https://codeload.github.com/Evernote/evernote-sdk-android/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650434,"owners_count":21139672,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T05:09:10.706Z","updated_at":"2025-04-13T00:46:38.497Z","avatar_url":"https://github.com/Evernote.png","language":"Java","funding_links":[],"categories":["Libs","SDK"],"sub_categories":["\u003cA NAME=\"SDK\"\u003e\u003c/A\u003eSDK"],"readme":"Evernote SDK for Android version 2.0.0-RC4\n==========================================\n\nEvernote API version 1.25\n\n\nOverview\n--------\nThis SDK wraps the [Evernote Cloud API ](http://dev.evernote.com/documentation/cloud/) and provides OAuth authentication functionality. The SDK is provided as an Android Library project that can be included in your application with Gradle.\n\nPrerequisites\n-------------\nIn order to use the code in this SDK, you need to obtain an API key from https://dev.evernote.com/doc/. You'll also find full API documentation on that page.\n\nIn order to run the demo code, you need a user account on the sandbox service where you will do your development. Sign up for an account at https://sandbox.evernote.com/Registration.action\n\nThe instructions below assume you have the latest [Android SDK](http://developer.android.com/sdk/index.html).\n\n\nDownload\n--------\n\nAdd the library as a dependency in your build.gradle file.\n\n```groovy\ndependencies {\n    compile 'com.evernote:android-sdk:2.0.0-RC4'\n}\n```\n\n##### (Optional) Using a snapshot build for early access previews\n\nAdd Sonatype's snapshot repository in your build script.\n```groovy\nmaven {\n    url \"https://oss.sonatype.org/content/repositories/snapshots\"\n}\n```\n\nAdd the snapshot depdendency.\n```groovy\ndependencies {\n    compile 'com.evernote:android-sdk:2.0.0-SNAPSHOT'\n}\n```\n\nDemo App\n--------\n\nThe demo application 'Evernote SDK Demo' demonstrates how to use the Evernote SDK for Android to authentication to the Evernote service using OAuth, then access the user's Evernote account. The demo code provides multiple activities that show notebook listing, note creation, and resource creation in two scenarios: A plain text note creator and an image saver.\n\n#### Running the demo app from Android Studio\nTo build and run the demo project from Android Studio:\n\n1. Open Android Studio\n2. Choose Import Project (Eclipse ADT, Gradle, etc.)\n3. Select the SDK root directory (the directory containing this README) and click OK\n4. Add your Evernote API consumer key and secret (see below)\n\n##### Adding Evernote API consumer key and secret\nYou have two different options to add your consumer key and secret.\n\n###### gradle.properties file (preferred)\n\n1. Open the folder `~/.gradle` in your user's home directory.\n2. Open or create a file called `gradle.properties`\n3. Add a line `EVERNOTE_CONSUMER_KEY=Your Consumer Key`\n4. Add a line `EVERNOTE_CONSUMER_SECRET=Your Consumer Secret`\n\n###### In code\n\n1. Open the class `com.evernote.android.demo.DemoApp.java`\n2. At the top of `DemoApp.java`, fill in your Evernote API consumer key and secret.\n\nUsage SDK\n---------\n\n#### Modify your `AndroidManifest.xml`\n\nThe SDK's OAuth functionality is implemented as an Android Activity that must be declared in your app's `AndroidManifest.xml`.\n\nStarting with Android Gradle plugin version 1.0.0 the necessary activities are merged in your app's `AndroidManifest.xml` file and you don't need to do anything. Otherwise simply copy and paste the following snippet into your `AndroidManifest.xml` within the application section:\n\n```xml\n\u003cactivity android:name=\"com.evernote.client.android.EvernoteOAuthActivity\" /\u003e\n\u003cactivity android:name=\"com.evernote.client.android.login.EvernoteLoginActivity\"/\u003e\n```\n\n#### Set up an `EvernoteSession`\n\nDefine your app credentials (key, secret, and host).  See http://dev.evernote.com/documentation/cloud/\n\n```java\nprivate static final String CONSUMER_KEY = \"Your consumer key\";\nprivate static final String CONSUMER_SECRET = \"Your consumer secret\";\nprivate static final EvernoteSession.EvernoteService EVERNOTE_SERVICE = EvernoteSession.EvernoteService.SANDBOX;\n```\n\nWhen your app starts, initialize the EvernoteSession singleton that has all of the information that is needed to authenticate to Evernote. The EvernoteSession instance of saved statically and does not need to be passed between activities. The better option is to build the instance in your onCreate() of the Application object or your parent Activity object.\n\n```java\nmEvernoteSession = new EvernoteSession.Builder(this)\n    .setEvernoteService(EVERNOTE_SERVICE)\n    .setSupportAppLinkedNotebooks(SUPPORT_APP_LINKED_NOTEBOOKS)\n    .build(consumerKey, consumerSecret)\n    .asSingleton();\n```\n\n#### Give the user a way to initiate authentication\n\nIn our demo app, we have a \"Login\" button that initiates the authentication process. You might choose to do something similar, or you might simply initiate authentication the first time that the user tries to access Evernote-related functionality.\n\nThe recommended approach is to use `FragmentActivity`s. Then the authentication process opens a dialog and no extra `Activity`. But normal `Activity`s are supported as well. \n\n```java\nmEvernoteSession.authenticate(this);\n```\n\n### Evernote and Yinxiang Biji Service Bootstrapping\n\nThe Activity that completes the OAuth authentication automatically determines if the User is on the Evernote service or the Yinxiang service and configures the end points automatically.\n\nIf you want to test if bootstrapping works within your app, you can either change the device's language to Chinese or you can set a specific Locale object in the session builder, e.g. `new EvernoteSession.Builder(this).setLocale(Locale.SIMPLIFIED_CHINESE)`. If the SDK can't decide which server to use, then the user has the option to change the Evernote service while authenticating.\n\n#### Complete authentication\n\nIf you use a `FragmentActivity`, you should implement the `EvernoteLoginFragment.ResultCallback` interface.\n\n\n```java\npublic class MyActivity extends Activity implements EvernoteLoginFragment.ResultCallback {\n\n    // ...\n\n    @Override\n    public void onLoginFinished(boolean successful) {\n        // handle result\n    }\n}    \n```\n\nIf you use a normal `Activity`, you should override `onActivityResult`.\n\n```java\n@Override\npublic void onActivityResult(int requestCode, int resultCode, Intent data) {\n    switch (requestCode) {\n        case EvernoteSession.REQUEST_CODE_LOGIN:\n            if (resultCode == Activity.RESULT_OK) {\n                // handle success\n            } else {\n                // handle failure\n            }        \n            break;\n            \n        default:\n            super.onActivityResult(requestCode, resultCode, data);\n            break;\n    }\n}\n```\n\nSnippets\n--------\n\nCalling `EvernoteSession.getEvernoteClientFactory()` will give you access to async wrappers around `NoteStore.Client` or `UserStore.Client`. Browse the API JavaDocs at http://dev.evernote.com/documentation/reference/javadoc/\n\nThe `EvernoteClientFactory` also creates multiple helper classes, e.g. `EvernoteHtmlHelper` to download a note as HTML.\n\nCreate an `EvernoteNoteStoreClient` to access primary methods for personal note data\n```java\nEvernoteSession.getInstance().getEvernoteClientFactory().getNoteStoreClient();\n```\n\nCreate an `EvernoteUserStoreClient` to access User related methods\n```java\nEvernoteSession.getInstance().getEvernoteClientFactory().getUserStoreClient();\n```\n\nCreate an `EvernoteBusinessNotebookHelper` to access Business Notebooks\n```java\nEvernoteSession.getInstance().getEvernoteClientFactory().getBusinessNotebookHelper();\n```\n\nCreate an `EvernoteLinkedNotebookHelper` to access shared notebooks\n```java\nEvernoteSession.getInstance().getEvernoteClientFactory().getLinkedNotebookHelper(linkedNotebook);\n```\n\n###### Getting list of notebooks asynchronously\n```java\nif (!EvernoteSession.getInstance().isLoggedIn()) {\n    return;\n}\n\nEvernoteNoteStoreClient noteStoreClient = EvernoteSession.getInstance().getEvernoteClientFactory().getNoteStoreClient();\nnoteStoreClient.listNotebooksAsync(new EvernoteCallback\u003cList\u003cNotebook\u003e\u003e() {\n    @Override\n    public void onSuccess(List\u003cNotebook\u003e result) {\n        List\u003cString\u003e namesList = new ArrayList\u003c\u003e(result.size());\n        for (Notebook notebook : result) {\n            namesList.add(notebook.getName());\n        }\n        String notebookNames = TextUtils.join(\", \", namesList);\n        Toast.makeText(getApplicationContext(), notebookNames + \" notebooks have been retrieved\", Toast.LENGTH_LONG).show();\n    }\n\n    @Override\n    public void onException(Exception exception) {\n        Log.e(LOGTAG, \"Error retrieving notebooks\", exception);\n    }\n});\n```\n\n###### Creating a note asynchronously\n```java\nif (!EvernoteSession.getInstance().isLoggedIn()) {\n    return;\n}\n\nEvernoteNoteStoreClient noteStoreClient = EvernoteSession.getInstance().getEvernoteClientFactory().getNoteStoreClient();\n\nNote note = new Note();\nnote.setTitle(\"My title\");\nnote.setContent(EvernoteUtil.NOTE_PREFIX + \"My content\" + EvernoteUtil.NOTE_SUFFIX);\n\nnoteStoreClient.createNoteAsync(note, new EvernoteCallback\u003cNote\u003e() {\n    @Override\n    public void onSuccess(Note result) {\n        Toast.makeText(getApplicationContext(), result.getTitle() + \" has been created\", Toast.LENGTH_LONG).show();\n    }\n\n    @Override\n    public void onException(Exception exception) {\n        Log.e(LOGTAG, \"Error creating note\", exception);\n    }\n});\n```\n\n###### Using the `EvernoteBusinessNotebookHelper` to Access Evernote Business data\n\n1. Check if user is member of a business\n2. Create `EvernoteBusinessNotebookHelper`\n3. Call synchronous methods from a background thread or call async methods from UI thread\n\nThis note store is not long lived, the Business authentication token expires frequently and is refreshed if needed in the `getBusinessNotebookHelper()` method.\n\nExample using the synchronous business methods inside a background thread to create a note in a business account\n\n```java\nnew Thread() {\n    @Override\n    public void run() {\n        try {\n            if (!EvernoteSession.getInstance().getEvernoteClientFactory().getUserStoreClient().isBusinessUser()) {\n                Log.d(LOGTAG, \"Not a business User\");\n                return;\n            }\n\n            EvernoteBusinessNotebookHelper businessNotebookHelper = EvernoteSession.getInstance().getEvernoteClientFactory().getBusinessNotebookHelper();\n            List\u003cLinkedNotebook\u003e businessNotebooks = businessNotebookHelper.listBusinessNotebooks(EvernoteSession.getInstance());\n            if (businessNotebooks.isEmpty()) {\n                Log.d(LOGTAG, \"No business notebooks found\");\n            }\n\n            LinkedNotebook linkedNotebook = businessNotebooks.get(0);\n\n            Note note = new Note();\n            note.setTitle(\"My title\");\n            note.setContent(EvernoteUtil.NOTE_PREFIX + \"My content\" + EvernoteUtil.NOTE_SUFFIX);\n\n            EvernoteLinkedNotebookHelper linkedNotebookHelper = EvernoteSession.getInstance().getEvernoteClientFactory().getLinkedNotebookHelper(linkedNotebook);\n            final Note createdNote = linkedNotebookHelper.createNoteInLinkedNotebook(note);\n\n            runOnUiThread(new Runnable() {\n                @Override\n                public void run() {\n                    Toast.makeText(getApplicationContext(), createdNote.getTitle() + \" has been created.\", Toast.LENGTH_LONG).show();\n                }\n            });\n\n        } catch (TException | EDAMUserException | EDAMSystemException | EDAMNotFoundException e) {\n            e.printStackTrace();\n        }\n    }\n}.start();\n\n```\n\nLicense\n=======\n    Copyright (c) 2007-2015 by Evernote Corporation, All rights reserved.\n\n    Use of the source code and binary libraries included in this package\n    is permitted under the following terms:\n\n    Redistribution and use in source and binary forms, with or without\n    modification, are permitted provided that the following conditions\n    are met:\n\n        1. Redistributions of source code must retain the above copyright\n        notice, this list of conditions and the following disclaimer.\n        2. Redistributions in binary form must reproduce the above copyright\n        notice, this list of conditions and the following disclaimer in the\n        documentation and/or other materials provided with the distribution.\n\n    THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR\n    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n    OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n    IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,\n    INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n    NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n    THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevernote%2Fevernote-sdk-android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fevernote%2Fevernote-sdk-android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fevernote%2Fevernote-sdk-android/lists"}