Although we recommended that you call Google Workspace APIs from a server using server-side authentication, these APIs can also be called using the Android or iOS SDKs.
Follow the following guides to setup an Android or iOS project with a Google Workspace API.
Android
Android devices can call Google Workspace APIs using the Google API Client Library for Java.
Prerequisites
- A Google account.
- Android Studio SDK 1.2 or later.
- Android SDK packages for API 23 or later, including the latest versions of Google Repository, Android Support Library and Google Play Services.
Prepare the project
In your Android project, include a build.gradle
file with dependencies such
as these:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.google.android.gms:play-services-auth:15.0.1'
compile 'pub.devrel:easypermissions:0.3.0'
compile('com.google.api-client:google-api-client-android:1.23.0') {
exclude group: 'org.apache.httpcomponents'
}
compile('com.google.apis:google-api-services-<API>-<VERSION>') {
exclude group: 'org.apache.httpcomponents'
}
}
Be sure to replace the API
and VERSION
with the
Google Workspace API and version. For
example, the Google Slides API would have the target
compile 'com.google.apis:google-api-services-slides:v1-rev294-1.23.0'
.
Once the service is authenticated, executing the API call is the same as shown in any of the Google Workspace Java quickstarts.
Further reading
- Google Developers Console help documentation
- Google APIs Client for Java documentation
- Android API Guides
- Google Play Services
- Google APIs for Mobile: Quickstarts
iOS
iOS devices can call Google Workspace APIs using the Google APIs Client Library for Objective-C for REST.
Prerequisites
To use Google Workspace APIs with the iOS Client Library for Objective-C, you'll need:
Prepare the project
Create a Podfile
for an Xcode project would be something like this:
platform :ios, '8.0'
target 'QuickstartApp' do
pod 'GoogleAPIClientForREST/Sheets', '~> 1.2.1'
pod 'GoogleSignIn', '~> 4.1.1'
end
In this example we used Sheets
, but the API could be any of the services
listed in the
Google API Objective-C Client for REST.
Full examples of using the Calendar API and Drive API can be found in the Google APIs Objective-C Client repo's Examples folder.