Skip to content

ZapicInc/Zapic-SDK-Android

Repository files navigation

Zapic SDK for Android

Travis CI Bintray Maven Central CodeFactor MIT Chat on Discord Twitter Follow

Copyright (c) 2017-2018 Zapic, Inc.

The Zapic SDK for Android is an open-source project that allows game developers to integrate with the Zapic platform from a game written in Kotlin or Java for Android. The Zapic SDK for Android supports devices running KitKat or higher (API 19).

Android, Kotlin, Google Play, and the Google Play logo are trademarks of Google LLC.

Oracle and Java are registered trademarks of Oracle and/or its affiliates.

Getting Started

Learn more about integrating the SDK and configuring your Android game in the Zapic platform at https://www.zapic.com/docs/android.

Community

Ask questions on Stack Overflow. Be sure to include the zapic tag with your question.

Chat on Discord.

Follow @ZapicInc on Twitter for important announcements.

Report bugs and discuss new features on GitHub.

Contributing

We accept contributions to the Zapic SDK for Android. Simply fork the repository and submit a pull request on GitHub.

Quick Links

Zapic Android Demo

This project includes a Zapic Android demo game configured with the Zapic SDK for Android. Zapic is initialized with the demo game by attaching a fragment to the main activity during the onCreate lifecycle event. See line 105 in MainActivity.java.

The demo game is very simple. The activity counts the number of pixels as a player drags their finger across the background image. After the player drags their finger, the activity submits a gameplay event with a DISTANCE parameter that includes the total number of pixels. See lines 211-215 in MainActivity.java.

The activity includes a Zapic branded button (required by the Terms of Use) that opens Zapic and shows the default page. See line 84 in MainActivity.java.

The activity also includes a "Challenges" button that explicitly opens the challenges page for the current game. See line 92 in MainActivity.java.

Try it out! Get it on Google Play, make a friend on Zapic, and challenge your friend to collect the most number of pixels!

Get it on Google Play

Zapic Android demo game screenshot Zapic challenge screenshot

Deep Links

The demo game has been configured to use the Branch third-party integration to provide deep links.

The deep links feature allows a player to share very specific content with friends, such as challenge invitations. The game is automatically launched when another player opens the deep link. The deep links feature also redirects players to the Play Store to download the game if it is not already installed.

The Branch SDK has been configured to relay deep links to Zapic. If a deep link references actionable Zapic content, such as a challenge invitiation, then the Zapic activity automatically launches with a specially tailored user interface. If a deep link does not reference actionable Zapic content, it is simply ignored. See lines 168-172 in MainActivity.java.

The Zapic SDK has also been configured to relay the unique user identifier to Branch. This enables user attribution within the Branch dashboard. See lines 41-59 in MainApplication.java.

Try it out! Open the link below on an Android device! The challenges page opens if the game is already installed. The Play Store opens if the game is not already installed.

Open the Zapic Android Demo (only configured to work on an Android device)

Try it out! Ask a friend to to challenge you and to share the unique challenge link via SMS, Twitter, etc.!

Zapic challenge share screenshot Zapic challenge invite screenshot

Push Notifications

The demo game has been configured to use the OneSignal third-party integration to provide push notifications.

The push notifications feature allows players to receive notifications as important events occur, such as challenge invitations, and to receive notifications that encourage re-engagement after a period of inactivity.

The OneSignal SDK has been configured to relay push notifications to Zapic. If a push notification references actionable Zapic content, such as a challenge invitiation, then the Zapic activity automatically launches with a specially tailored user interface. If a push notification does not reference actionable Zapic content, it is simply ignored. See lines 31-34 in MainApplication.java.

The Zapic SDK has also been configured to relay the user's unique push notification token to OneSignal. Zapic uses the unique push notification token, not the user identifier, when sending content to users. This helps prevent users from impersonating one another (refer to the OneSignal documentation for more context). See lines 41-59 in MainApplication.java.

Try it out! Ask a friend to challenge you! The push notification should be delivered shortly after the challenge has been created.

Zapic challenge notification screenshot Zapic challenge invite screenshot

Building from Source

The demo application and library are built from source using Android Studio 3.1 or higher and the latest version of the Android SDK.

Releasing the Library

  1. Bump the library module's versionName in build.gradle. (The bump should follow the SemVer 2.0 standard.)
  2. Create a commit with the new version.
  3. Push the commit to the master branch on GitHub.
    • Ensure the Travis CI build completes without errors.
  4. Tag the commit on GitHub. The tag name should match the versionName.
    • Ensure the Travis CI build and deploy completes without errors.
  5. Edit the release notes on the new GitHub release.
  6. Publish the new GitHub release.
  7. Edit the new Bintray package version. Namely, fix the "unspecified" VCS tag in the package version properties.
  8. Publish the new Bintray package artifacts.
  9. Sync the Bintray package with Maven Central.
  10. Update the package version in the Android integration documentation.
  11. (Optional) Announce the new package on Discord.