Skip to content

Latest commit

 

History

History

samples-android

Android Google Play Games Native Samples
=======================================
A set of the sample to demonstrate how to use Google Play Games Native Interface on Android:
- create gpg native object
- manage leaderboard, achievement, event, and others
- interact with game graphics

Pre-requisites
--------------
1. Change the applicationId inside each individual samples build.gradle to your own package name
1. Update the `app_id` and any configured constants in the sample's `src/main/res/values/id.xml` file to those registered in the [Play Games Services console](https://play.google.com/apps/publish)

Build with Android Studio
-------------------------
This project requires Android Studio 1.5+ with ndk support
1. Launch Android Studio.
1. Open the sample project at cpp-android-basic-samples/samples-android
1. Disable "Instant Run" from Settings-> Build Execution, Deployment -> Instant Run
1. Select project gpg-sdk in Android Studio "project" pane, unzip_gpg_sdk build task [in toolbar]
1. Run the selected build task of "samples-android:Common:gpg-sdk [unzip_gpg_sdk]"
1. Select the project you are interested
1. Change applicationId in your-project build.gradle to your own package name
1. Chagne app_id in string.xml ( or ids.xml ) to your game ID
1. Run the select project. Android Studio will compile, load and start your project on your device

All projects could be built at one shot from Android Studio menu "Build" -> "Clean Project"/"Rebuild Project"
you could also build with Gradle on Terminal/Command line

Build using Gradle on OS X or Linux
-----------------------------------
1. Install Android Studio
1. Set the path to the Android SDK

    export ANDROID_HOME=~/Library/Android/sdk

1. Add the SDK to your path

    export PATH=$PATH;$ANDROID_HOME/tools;$ANDROID_HOME/platform-tools

1. Set the path to the Android NDK

    export ANDROID_NDK_HOME=<PATH_TO_NDK>/android-ndk-r10e

1. Execute the build script

    ./gradlew assemble

Build on Windows using Gradle
-----------------------------
1. Install Android Studio
1. Set the path to the Android SDK

    set ANDROID_HOME=C:\Users\<yourusername>\AppData\Local\Android\sdk

1. Add the SDK to your path

    set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools

1. Set the path to the Android NDK

    set ANDROID_NDK_HOME=C:\Users\<yourusername>\Desktop\android-ndk-r10e

1. (Optional) On some versions of Windows it is helpful to map the samples folder to a shortened path.

    subst G: C:\<full-path-to-sample-folder>

1. Execute the build script

    G:
    gradlew.bat assemble

Support
-------
If you've found an error in these samples, please [file an issue](https://github.com/playgameservices/cpp-android-basic-samples/issues/new).

Patches are encouraged, and may be submitted by [forking this project](https://github.com/playgameservices/cpp-android-basic-samples/fork) and
submitting a pull request through GitHub. Please see [CONTRIBUTING.md](CONTRIBUTING.md) for more details.

- [Stack Overflow](http://stackoverflow.com/questions/tagged/google-play-games)
- [Android Tools Feedbacks](http://tools.android.com/feedback)


License
-------
Copyright 2015 Google, Inc.

Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements.  See the NOTICE file distributed with this work for
additional information regarding copyright ownership.  The ASF licenses this
file to you under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License.  You may obtain a copy of
the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
License for the specific language governing permissions and limitations under
the License.