G Suite Mobile APIs for Android and iOS

Although it is recommended that G Suite APIs are called 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 G Suite API.

Android

Android devices can call G Suite APIs using the Google API Client Library for Java.

Prerequisites

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 G Suite 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 G Suite Java quickstarts.

Further Reading

iOS

iOS devices can call G Suite APIs using the Google APIs Client Library for Objective-C for REST.

Prerequisites

To use G Suite APIs with the iOS Client Library for Objective-C, you'll need:

  • A Google account.
  • Xcode 8.0 or greater.
  • CocoaPods dependency manager.

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.

Further Reading