{"id":20054319,"url":"https://github.com/onedrive/onedrive-sdk-android","last_synced_at":"2025-05-05T13:31:09.747Z","repository":{"id":83458880,"uuid":"45077814","full_name":"OneDrive/onedrive-sdk-android","owner":"OneDrive","description":"OneDrive SDK for Android!","archived":true,"fork":false,"pushed_at":"2017-11-22T12:56:44.000Z","size":314,"stargazers_count":150,"open_issues_count":1,"forks_count":54,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-03-17T06:24:58.384Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://dev.onedrive.com","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OneDrive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-10-28T00:06:52.000Z","updated_at":"2025-03-07T19:20:45.000Z","dependencies_parsed_at":"2023-04-17T06:16:17.409Z","dependency_job_id":null,"html_url":"https://github.com/OneDrive/onedrive-sdk-android","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OneDrive%2Fonedrive-sdk-android","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OneDrive%2Fonedrive-sdk-android/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OneDrive%2Fonedrive-sdk-android/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OneDrive%2Fonedrive-sdk-android/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OneDrive","download_url":"https://codeload.github.com/OneDrive/onedrive-sdk-android/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252506385,"owners_count":21759040,"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-13T12:39:47.442Z","updated_at":"2025-05-05T13:31:09.741Z","avatar_url":"https://github.com/OneDrive.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OneDrive SDK for Android\n\n[ ![Download](https://api.bintray.com/packages/onedrive/Maven/onedrive-sdk-android/images/download.svg) ](https://bintray.com/onedrive/Maven/onedrive-sdk-android/_latestVersion)\n[![Build Status](https://travis-ci.org/OneDrive/onedrive-sdk-android.svg?branch=master)](https://travis-ci.org/OneDrive/onedrive-sdk-android)\n\nIntegrate the [OneDrive API](https://dev.onedrive.com/README.htm) into your Android application!\n\n## 1. Installation\n### 1.1 Install AAR via Gradle\nAdd the maven central repository to your projects build.gradle file then add a compile dependency for com.onedrive.sdk:onedrive-sdk-android:1.3+\n\n```gradle\nrepository {\n    jcenter()\n}\n\ndependency {\n    // Include the sdk as a dependency\n    compile ('com.onedrive.sdk:onedrive-sdk-android:1.3+') {\n        transitive = false\n    }\n\n    // Include the gson dependency\n    compile ('com.google.code.gson:gson:2.3.1')\n\n    // Include supported authentication methods for your application\n    compile ('com.microsoft.services.msa:msa-auth:0.8.+')\n    compile ('com.microsoft.aad:adal:1.1.+')\n}\n```\n\n## 2. Getting started\n\n### 2.1 Register your application\n\nRegister your application by following [these](https://dev.onedrive.com/app-registration.htm) steps.\n\n### 2.2 Set your application Id and scopes\n\nThe OneDrive SDK for Android comes with Authenticator objects that have already been initialized for OneDrive with Microsoft accounts and Azure Activity Directory accounts. Replace the current settings with the required settings to start authenticating.\n\nApplication that authenicate via MSA need to have a [scope of access](https://github.com/OneDrive/onedrive-api-docs/blob/master/auth/msa_oauth.md#authentication-scopes) defined to use features on OneDrive.  If your application is being used in for OneDrive for business AAD will need the [administrators consent](https://dev.onedrive.com/app-registration.htm) for your application to communicate with OneDrive.\n\nNote that your _msa-client-id_ and _adal-client-id_ should look be in GUID format like `00000000-0000-0000-0000-000000000000`. For legacy MSA application, the _msa-client-id_ should look like `0000000000000000`.\n\n```java\nfinal MSAAuthenticator msaAuthenticator = new MSAAuthenticator() {\n    @Override\n    public String getClientId() {\n        return \"\u003cmsa-client-id\u003e\";\n    }\n\n    @Override\n    public String[] getScopes() {\n        return new String[] { \"onedrive.appfolder\" };\n    }\n}\n\nfinal ADALAuthenticator adalAuthenticator = new ADALAuthenticator() {\n    @Override\n    public String getClientId() {\n        return \"\u003cadal-client-id\u003e\";\n    }\n\n    @Override\n    protected String getRedirectUrl() {\n        return \"https://localhost\";\n    }\n}\n```\n\n### 2.3 Get a OneDriveClient object\n\nOnce you have set the correct application Id and scopes, you must get a **OneDriveClient** object to make requests against the service. The SDK will store the account information for you, but when a user logs on for the first time, it will invoke UI to get the user's account information.\n\n```java\nfinal IClientConfig oneDriveConfig = DefaultClientConfig.createWithAuthenticators(\n                                            msaAuthenticator,\n                                            adalAuthenticator);\n                                            \nfinal DefaultCallback\u003cIOneDriveClient\u003e callback = new DefaultCallback\u003cIOneDriveClient\u003e(activity) {\n            @Override\n            public void success(final IOneDriveClient result) {\n                // OneDrive client created successfully.\n            }\n\n            @Override\n            public void failure(final ClientException error) {\n                // Exception happened during creation.\n            }\n        };\n        \nfinal IOneDriveClient oneDriveClient = new OneDriveClient.Builder()\n                                            .fromConfig(oneDriveConfig)\n                                            .loginAndBuildClient(getActivity(), callback);\n\n```\n\n## 3. Make requests against the service\n\nOnce you have an OneDriveClient that is authenticated you can begin making calls against the service. The requests against the service look like our [REST API](https://dev.onedrive.com/README.htm).\n\n### Get the drive\n\nTo retrieve a user's drive:\n\n```java\noneDriveClient\n    .getDrive()\n    .buildRequest()\n    .get(new ICallback\u003cDrive\u003e() {\n  @Override\n  public void success(final Drive result) {\n    final String msg = \"Found Drive \" + result.id;\n    Toast.makeText(getActivity(), msg, Toast.LENGTH_SHORT)\n        .show();\n  }\n  ...\n  // Handle failure case\n});\n```\n\n### Get the root folder\n\nTo get a user's root folder of their drive:\n\n```java\noneDriveClient\n    .getDrive()\n    .getRoot()\n    .buildRequest()\n    .get(new ICallback\u003cItem\u003e() {\n  @Override\n  public void success(final Item result) {\n    final String msg = \"Found Root \" + result.id;\n    Toast.makeText(getActivity(), msg, Toast.LENGTH_SHORT)\n        .show();\n  }\n  ...\n  // Handle failure case\n});\n```\n\nFor a general overview of how the SDK is designed, see [overview](docs/overview.md).\n\n## 4. Documentation\n\nFor a more detailed documentation see:\n\n* [Overview](docs/overview.md)\n* [Authentication](docs/authentication.md)\n* [Extensibility](docs/extensibility.md)\n* [Items](docs/items.md)\n* [Collections](docs/collections.md)\n* [Errors](docs/errors.md)\n* [Contributions](docs/contributions.md)\n\n## 5. Issues\n\nFor known issues, see [issues](https://github.com/OneDrive/onedrive-sdk-android/issues).\n\n## 6. Contributions\n\nThe OneDrive SDK is open for contribution. Please read how to contribute to this project [here](docs/contributions.md).\n\n## 7. Supported Android Versions\nThe OneDrive SDK for Android library is supported at runtime for [Android API revision 15](http://source.android.com/source/build-numbers.html) and greater. To build the sdk you need to install Android API revision 23 or greater.\n\n## 8. License\n\n[License](LICENSE)\n\n## 9. Third Party Notices\n\n[Third Party Notices](THIRD PARTY NOTICES)\n\n## 10. Code of Conduct\n\nThis project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonedrive%2Fonedrive-sdk-android","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonedrive%2Fonedrive-sdk-android","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonedrive%2Fonedrive-sdk-android/lists"}