Skip to main content
Version: 8.9.x

Native Android Sample App

The BFG Native Android SDK includes a sample project that demonstrates the integration of the BFG SDK for games developed on our native Android platform. In it, you will find useful code samples that integrate key features of the SDK into your game, such as user authentication, purchasing, ad monetization, and more.

info

This document is for the Native Android sample app. If developing in Unity, see the Unity Sample App documentation.

Getting the Sample App

  1. Download the most up-to-date version of the Native Android SDK from Big Fish’s GitHub release repo.
  2. For the SDK release you want to integrate, extract the contents of the gzipped tarball.
  3. Launch Android Studio and select File > Open a Project.
  4. Navigate to android_studio_projects, located in the SDK release folder.
  5. Select the "bfgSampleApps" folder and click Open.

Sample App File Structure

DirectoryDescription
bfgSampleApps/bfgLib-debugContains the BFG Android SDK bar file - debug.
bfgSampleApps/bfgLib-releaseContains the BFG Android SDK bar file - release.
bfgSampleApps/RaveFacebookPluginContains the RaveFacebookPlugin
bfgSampleApps/RaveGooglePluginContains the RaveGooglePlugin
bfgSampleApps/src/amazonf2pContains amazon specific config and assets
bfgSampleApps/src/googlef2pContains google specific config and assets
bfgSampleApps/src/mainContains the sampleApps code

Building the Sample App

After downloading the sample app, there is no special configuration needed to build the project.

  1. Open the sample app in Android Studio.
  2. Select the target device to build to.
  3. Click Run.

Key Feature Implementation

The following table lists the key features that are implemented in the sample project and where you can find the configuration and code for each feature.

FeatureImplementation

Account Deletion

Implemented by calling requestAccountDeletion() in GameUI.java.

Ad Attribution

AppsFlyer initialized in the config file, bfg_config.json, located in src > res > row

Crash Reporting

Implemented in CrashlyticsActivity.java

  • Log events with log(@NonNull String message)
  • Record exceptions with recordException(@NonNull Exception exception)

Customer Service Platform

Implemented in bfgManagerInternal.java with the showSupport method

Deep Linking

Implemented in bfgGameReporting.java

Listener passed in the OnCreate() method of MainActivity.java:

bfgGameReporting.sharedInstance().setDeepLinkListener(this);

GDPR Compliance

Implemented in bfgGdprManager.java

Listener being passed in the onStart() method of MainActivity.java:

bfgManager.addPolicyListener(mPolicyListener);

Identity Management & Player Authentication

Implemented in MainActivity.java and in the onResume() and OnPause() methods

In-App Purchasing

Implemented in PurchaseController.java