Capture the Flag is a sample application demonstrating the use of Nokia X services on Nokia X software platform: HERE Maps, Nokia Notifications and Nokia In-App Payment. The application also implements the corresponding Google APIs and utilises them when the same APK file is installed on a Google services enabled phone. The detection of services…
Java JavaScript Groovy
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
capture-the-flag-server
capture-the-flag
doc
gradle/wrapper
.gitignore
.gitmodules
License.txt
README.md
build.gradle
gradlew
gradlew.bat
settings.gradle

README.md

Capture the Flag

Capture the Flag is a sample application demonstrating the use of Nokia X services on Nokia X software platform: HERE Maps, Nokia Notifications and Nokia In-App Payment. The application also implements the corresponding Google APIs and utilises them when the same APK file is installed on a Google services enabled phone. The detection of services is done run-time. OpenIAB is used to implement the in-app payment feature.

The app itself is based on the traditional outdoor game where two teams each have their own flags, which the opposing team then tries to capture. The flags in the game are randomly placed on the map within a fixed distance of the player creating the game. The team who manages to get to the flag of the opposing team first wins.

Main menu  Offline game ongoing

This demo application is hosted in GitHub (https://github.com/nokia-developer/capture-the-flag) where you can find the source code and documentation of the latest release.

Visit the project wiki for documentation: https://github.com/nokia-developer/capture-the-flag/wiki

Offline documentation is provided with this project in doc folder.

How to set up and build the project

Dependencies

The example is dependent on the following libraries, which are provided with the project:

  • AndroidAsync is a low level network protocol library. The project is hosted in GitHub: https://github.com/koush/AndroidAsync
  • HERE API library (com.here.android.sdk.jar)
  • Nokia Notifications helper library (push.jar)
  • OpenIAB provides cross-platform in-app payment functionality and encapsulates both Nokia In-App Payment API and Google In-App Billing API. The project is hosted in GitHub: https://github.com/onepf/OpenIAB

In order to build the project you will also need Google Play services library. The library can be installed via Android SDK Manager (Extras -> Google Play services).

API keys and IDs

Instructions for Eclipse

  1. Import the project in Eclipse (File -> Import...)

  2. Import Google Play services library project (*File -> Import...)

    • The library is located by default in <Android SDK path>/extras/google/google_play_services/libproject folder, when installed with the Android SDK Manager
    • Make sure Is Library check box is checked in Google Play services project properties (Properties -> Android)
  3. Add reference to Google Play services SDK

  4. Check that the references are properly setup in Java Build Path (see the following figures)

    • Note that it is especially important that HERE Maps library is not exported! Otherwise, the app will crash.

    Project properties: Libraries

    Project properties: Order and Export

  5. To run the app, select Run -> Run As -> Android Application

Importing the project in IntelliJ IDEA

  1. Launch the IDE (with projects closed) and select Import Project
  2. Browse to the root of the project and select settings.gradle file
  3. Select option Use default gradle wrapper (recommended) and click OK

Instructions for Gradle

  1. Open terminal/command prompt
  2. Navigate to the root of the project (not to the root of the client app, but the entire project)
  3. Clean, build and deploy
    • In Linux/Mac OS, run command: ./gradlew clean installDebug
    • In Windows, run command: gradlew clean installDebug

Game server

To play the online version of the game, a server is needed. The server software is provided with the project, see /server. The software is implemented utilising node.js and socket.io library. To test the server, you can use free server services such as Heroku or Cloud9. For more information see the README for the server software and the project wiki.

License

See the license text file provided with the project. The license is also available online at https://github.com/nokia-developer/capture-the-flag/blob/master/License.txt

Related documentation

Version history

  • Version 2.0: One APK solution update - Maps/location, notifications and in-app payment services selected run-time based on which services are available on the phone (either Nokia X or Google services).
  • Version 1.0: The initial release.