forked from playgameservices/android-basic-samples
-
Notifications
You must be signed in to change notification settings - Fork 1
/
FAQ.txt
100 lines (72 loc) · 4.55 KB
/
FAQ.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
GOOGLE PLAY GAMES - ANDROID SAMPLES
FREQUENTLY ASKED QUESTIONS
[0] Why should I use BaseGameActivity/GameHelper instead of the regular API?
BaseGameActivity and GameHelper are not a substitute for the regular
Google Play Games API. Rather, they are sample helper classes intended to
implement the boilerplate code that typical games use to implement the
sign-in and connection management process. You are not required to use
these sample helpers, but doing so might save you some work.
[1] How should I compile BaseGameUtils into my project?
Include BaseGameUtils as a library project. Consult your build system's
documentation as to how to accomplish this, since this varies by IDE.
If you are using Gradle, you can add the BaseGameUtils directory to
your project and adjust your project's build.gradle files to reflect
a dependency on BaseGameUtils. For an example, see the build.gradle
files in the sample. Particularly, the BasicSamples is set up as
a gradle multi-project where several different apps (the samples)
depend on the BaseGameUtils library.
You should NOT compile the BaseGameUtils classes as stand-alone JAR files
into your project. Doing so will cause them not to be able to find their
resources, and might cause problems.
If you want more simplicity and don't want to deal with build system
red tape, you can adopt the less organized approach of dropping in
the BaseGameUtil java files into your project; if you do, remember to
also copy the BaseGameUtil resources into your project's res/
directory.
[2] I already have an Activity base class! Can I use BaseGameActivity?
No (but read on). Java does not support multiple inheritance, so you can't
simultaneously derive from BaseGameActivity and another Activity class.
However, you will notice that BaseGameActivity is actually a thin shell
over the piece that does the real work, which is GameHelper. If you can't
subclass BaseGameActivity, all you have to do is use the GameHelper
in your code and call its lifecycle methods when your Activity gets
the corresponding lifecycle events.
[3] If I'm using other Google APIs, should I still use BaseGameActivity
and/or GameHelper?
Yes. If you are using other Google APIs in addition to games, you can
integrate those into the same client
[4] Why is GameHelper/BaseGameActivity attempting to sign in on
application startup?
The default behavior of BaseGameActivity and GameHelper is to show the user
the sign-in flow (consent dialogs, etc) as soon as your application starts.
Naturally, once the user signs in for the first time, they won't see the
consent flow again, so it will be a seamless experience. It is important
for the user to sign in as early as possible so your application can take
advantage of the Google Play Games API right away (for example, saving the
user's progress using Cloud Save, unlocking achievements, etc). If the user
cancels the sign-in flow, BaseGameAcitivity/GameHelper will remember that
cancellation. If the total number of cancellations reaches a predefined
maximum (by default, 3), the user will no longer be prompted to sign in on
application startup. If that happens, they can still sign in by clicking
your application's Sign In button, if you provide one.
[5] I don't like the new "auto sign in" feature of GameHelper. How can
I disable it?
To disable this feature and return to the old behavior, you can edit
GameHelper.java and set the DEFAULT_MAX_SIGN_IN_ATTEMPTS constant to 0, or
call GameHelper.setMaxAutoSignInAttempts(0) at runtime, before calling
GameHelper.setup() (or, correspondingly, from your Activity's onCreate
method).
[6] I think the default error dialogs are ugly. I want to make my own.
How can I do this?
For convenience, BaseGameActivity and GameHelper show error dialogs
with appropriate error messages for each kind of error. If you want
to disable that behavior and make your own dialog boxes, you can
call GameHelper.setShowErrorDialogs(false) to inhibit the default
dialog boxes, then show your own when you get an onSignInFailed().
To retrieve details about the failure, you can call
GameHelper.getSignInError().
[7] I need to localize the sign-in failure message (and other error messages
shown by BaseGameActivity and GameHelper). How can I do that?
Simply translate the string resources found in
res/values/gamehelper_strings.xml into the corresponding locale folders,
as you would any other string resouce in Android.