0

I have hit a problem with signing in to Google Play in my application for Google Play Services API. I am currently using BaseGameUtils for achievements, and I have found that to use it in an activity, the activity must extend BaseGameUtils, or BaseGameActivity.

Here is where my problem is; All the the activities that I need to use BaseGameUtils with already extend classes that are required for proper function. Here's an example:

    // This would be in Play.java, one of the main activities in use

    public class Play extends GameState {
        private boolean debug = true;

        // I want to extend BaseGameUtils from this class, yet I need to
        // Extend GameState to retain functional operation
    }

How would I go about doing this using BaseGameUtils if I can't extend from it, and how could I use it when, where I need it, already extends another class.

P.S. I already have BaseGameUtils and everything needed set up and working. However without the sign in feature, it is useless and crashes the game. I have places a few try/catches in my code to stop this for debugging purposes.

MabeeDev
  • 15
  • 1
  • 7

1 Answers1

0

Using BaseGameActivity is not at all required. Looking at the source for BaseGameActivity, it delegates all of the functionality to GameHelper which can be instantiated and used by any type of activity - just pass on the appropriate lifecycle events from your custom Activity classes to GameHelper directly.

ianhanniballake
  • 191,609
  • 30
  • 470
  • 443
  • If this is the case, then how would I use "Games.Achievements.unlock?" When I do not extend off of BaseGameUtils, it does not allow me to call things like getApiClient. I'm relatively new to the SDK, however I have a lot of experience with the JDK. I find that simple things like this prove to be difficult when it comes to the SDK. – MabeeDev Aug 17 '14 at 21:30
  • You did look at the source code? BaseGameActivity's `getApiClient()` calls `GameHelper.getApiClient()`. – ianhanniballake Aug 17 '14 at 21:33