Office 365 Connect Sample for Android
日本 (日本語) (Japanese)
Connecting to Office 365 is the first step every Android app must take to start working with Office 365 services and data. This sample shows how to connect and then call one API.
To run the Connect sample, your device needs to meet the following requirements:
- A screen size of 800 x 480 or larger.
- Android API level 15 or later.
To use the Office 365 Connect sample for Android you need the following:
Android Studio version 1.0 or later.
An Office 365 account. You can join the Office 365 Developer Program and get a free 1 year subscription to Office 365 that includes the resources that you need to start building Office 365 apps.
Note: If you already have a subscription, the previous link sends you to a page that says Sorry, you can’t add that to your current account. In that case use an account from your current Office 365 subscription.
If you are already signed-in to Office 365, the Sign-in button in the previous link shows the message Sorry, we can't process your request. In that case sign-out from Office 365 in that same page and sign-in again.
A Microsoft Azure tenant to register your application. Azure Active Directory provides identity services that applications use for authentication and authorization. A trial subscription can be acquired here: Microsoft Azure.
Important: You will also need to ensure your Azure subscription is bound to your Office 365 tenant. To do this see the Active Directory team's blog post, Creating and Managing Multiple Windows Azure Active Directories. The section Adding a new directory will explain how to do this. You can also see Set up your Office 365 development environment and the section Associate your Office 365 account with Azure AD to create and manage apps for more information.
A client id and redirect uri values of an application registered in Azure. The application must be granted the Send mail as a user permission. Add a native client application in Azure and grant proper permissions to it.
Open the sample using Android Studio
Download or clone this sample.
Start Android Studio.
- Close any projects that you might have open, then select Open an existing Android Studio project.
- Browse to your local repository and select the O365-Android-Connect project. Click OK.
Note: Android Studio might display a dialog asking if you want to use Gradle wrapper. Click OK.
Additionally, Android Studio shows a Frameworks detected notification if you don't have the Android Support Repository installed. Open the SDK manager and add the Android Support Repository to avoid the Frameworks detected notification.
- Find the
CLIENT_IDconstant and set its String value equal to the client id you registered in Azure Active Directory.
- Find the
REDIRECT_URIconstant and set its String value equal to the redirect URI you registered in Azure Active Directory.
Note: If you have don't have CLIENT_ID and REDIRECT_URI values, add a native client application in Azure and take note of the CLIENT_ID and REDIRECT_URI.
- Find the
Once you've built the Connect sample, you can run it on an emulator or device. Pick a device with API level 15 or higher from the Choose device dialog.
To learn more about the sample, visit our understanding the code wiki page. If you just want to use this code sample in your app, visit the Using the O365 Android Connect sample code in your app.
Questions and comments
We'd love to get your feedback on the O365 Android Connect project. You can send your questions and suggestions to us in the Issues section of this repository.
Questions about Office 365 development in general should be posted to Stack Overflow. Make sure that your questions or comments are tagged with [Office365] and [API].
This sample just shows the essentials that your apps need to work with Office 365. There is so much more that your apps can do using the Office 365 APIs, like helping your users to manage their work day with calendar, find just the information they need in all the files they store in OneDrive, or find the exact person they need from their list of contacts. We have more to share with you in the Office 365 APIs Starter Project for Android. We think it can help you fuel your ideas.
- Office 365 APIs platform overview
- Office 365 SDK for Android
- Get started with Office 365 APIs in apps
- Office 365 APIs starter projects and code samples
- Office 365 Code Snippets for Android
- Office 365 APIs Starter Project for Android
- Office 365 Profile sample for Android
Copyright (c) 2015 Microsoft. All rights reserved.