AbAppletic AbAppletic - 1 year ago 183
Android Question

Google sign in without any fragments? If not, how T do I create a "Fragment"?

So I've recently tried implementing Google Sign in. The problem is I'm not much of a fan of

s, and I'm stuck at this line in the docs:

Then, also in your sign-in activity's onCreate method, create a GoogleApiClient object with access to the Google Sign-In API and the options you specified.

// Build a GoogleApiClient with access to the Google Sign-In API and the
// options specified by gso.
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)

I know, I know, SO isn't much of a "walk-me-through" kind of thing. So here's my question, since this isn't mentioned in the blog, how do I create the fragment needed for this layout? The comment:
/* FragmentActivity */
clearly states I need a fragment, or maybe I CAN do it WITHOUT a fragment? I've easily implemented Facebook, but as usual, Google is giving me a hard time :|

And I'm using this along with Firebase.

Answer Source

A Fragment is not needed. AppCompatActivity is a subclass of FragmentActivity. If you are using AppCompatactivity, it can be used as the first argument to enableAutoManage().

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download