IGoogleApiClient buildGoogleApiClient(bool useProfileScope) { var builder = new GoogleApiClientBuilder(this) .AddConnectionCallbacks(this) .AddOnConnectionFailedListener(this); var serverClientId = GetString(Resource.String.server_client_id); if (!string.IsNullOrEmpty(serverClientId)) { builder.RequestServerAuthCode(serverClientId, this); } if (useProfileScope) { builder.AddApi(PlusClass.API) .AddScope(PlusClass.ScopePlusProfile); } else { builder.AddApi(PlusClass.API, new PlusClass.PlusOptions.Builder() .AddActivityTypes(MomentUtil.ACTIONS).Build()) .AddScope(PlusClass.ScopePlusLogin); } return(builder.Build()); }
public GeolocatorImplementation() { if (IsGooglePlayServicesInstalled()) { var builder = new GoogleApiClientBuilder(this.Context); builder.AddApi(LocationServices.Api); builder.AddConnectionCallbacks(this); builder.AddOnConnectionFailedListener(this); _googleAPI = builder.Build(); //_googleAPI = new GoogleApiClientBuilder(this.Context).AddApi(LocationServices.Api).AddConnectionCallbacks(this).AddOnConnectionFailedListener(this).Build(); locRequest = new LocationRequest(); } else { Toast.MakeText(this.Context, "Google Play Services is not installed", ToastLength.Long).Show(); } }
void CreateClient() { string id = GamerPlatformSettings.Instance.PlayerId; var builder = new GoogleApiClientBuilder(AppMain.Activity, this, this); builder.AddApi(Android.Gms.Games.GamesClass.Api); builder.AddScope(Android.Gms.Games.GamesClass.ScopeGames); builder.SetGravityForPopups((int)GravityForPopups); builder.SetViewForPopups(AppMain.Current.RootView); if (!string.IsNullOrEmpty(id)) { builder.SetAccountName(id); } _client = builder.Build(); }
private void CreateClient() { // did we log in with a player id already? If so we don't want to ask which account to use var settings = this.activity.GetSharedPreferences("googleplayservicessettings", FileCreationMode.Private); var id = settings.GetString("playerid", String.Empty); var builder = new GoogleApiClientBuilder(activity, this, this); builder.AddApi(Android.Gms.Games.GamesClass.Api); builder.AddScope(Android.Gms.Games.GamesClass.ScopeGames); builder.SetGravityForPopups((int)GravityForPopups); if (ViewForPopups != null) { builder.SetViewForPopups(ViewForPopups); } if (!string.IsNullOrEmpty(id)) { builder.SetAccountName(id); } client = builder.Build(); }
void AppReady() { _isGooglePlayServicesInstalled = IsGooglePlayServicesInstalled(); if (_isGooglePlayServicesInstalled) { locRequest = new LocationRequest(); var builder = new GoogleApiClientBuilder(this); builder.AddApi(LocationServices.Api); builder.AddConnectionCallbacks(this); builder.AddOnConnectionFailedListener(this); locClient = builder.Build(); } else { Log.Error("OnCreate", "Google Play Services is not installed"); Toast.MakeText(this, "Google Play Services is not installed", ToastLength.Long).Show(); Finish(); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.Login); mGoogleSignIn = FindViewById <SignInButton>(Resource.Id.sign_in_button); mGoogleSignIn.Click += mGoogleSignIn_Click; GoogleApiClientBuilder builder = new GoogleApiClientBuilder(this); builder.AddConnectionCallbacks(this); builder.AddOnConnectionFailedListener(this); builder.AddApi(PlusClass.Api); builder.AddScope(PlusClass.ScopePlusProfile); builder.AddScope(PlusClass.ScopePlusLogin); //Build our IGoogleApiClient mGoogleApiClient = builder.Build(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Login); strCooperativa = Intent.GetStringExtra(clsConstantes.strCooperativas); mGoogleSingIn = FindViewById <SignInButton>(Resource.Id.sign_in_button); mGoogleSingIn.Click += mGoogleSignIn_Click; GoogleApiClientBuilder builder = new GoogleApiClientBuilder(this); builder.AddConnectionCallbacks(this); builder.AddOnConnectionFailedListener(this); builder.AddApi(PlusClass.API); builder.AddScope(PlusClass.ScopePlusProfile); builder.AddScope(PlusClass.ScopePlusLogin); mGoogleApiClient = builder.Build(); }
private void CreateClient() { // did we log in with a player id already? If so we don't want to ask which account to use var settings = this.activity.GetSharedPreferences ("googleplayservicessettings", FileCreationMode.Private); var id = settings.GetString ("playerid", String.Empty); var builder = new GoogleApiClientBuilder (activity, this, this); builder.AddApi (Android.Gms.Games.GamesClass.Api); builder.AddScope (Android.Gms.Games.GamesClass.ScopeGames); builder.SetGravityForPopups ((int)GravityForPopups); if (ViewForPopups != null) builder.SetViewForPopups (ViewForPopups); if (!string.IsNullOrEmpty (id)) { builder.SetAccountName (id); } client = builder.Build (); }
IGoogleApiClient buildGoogleApiClient(bool useProfileScope) { var builder = new GoogleApiClientBuilder (this) .AddConnectionCallbacks (this) .AddOnConnectionFailedListener (this); var serverClientId = GetString (Resource.String.server_client_id); if (!string.IsNullOrEmpty (serverClientId)) builder.RequestServerAuthCode (serverClientId, this); if (useProfileScope) { builder.AddApi (PlusClass.API) .AddScope (PlusClass.ScopePlusProfile); } else { builder.AddApi (PlusClass.API, new PlusClass.PlusOptions.Builder() .AddActivityTypes (MomentUtil.ACTIONS).Build ()) .AddScope (PlusClass.ScopePlusLogin); } return builder.Build (); }
public void Setup() { _googleSearchEngineApiClientBuilder = new GoogleApiClientBuilder(); _bingSearchEngineApiClientBuilder = new BingApiClientBuilder(); _service = new SearchEnginesServices(_googleSearchEngineApiClientBuilder.Build(), _bingSearchEngineApiClientBuilder.Build()); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); //mGoogleApiClient = new GoogleApiClientBuilder(this).AddApi(Plus.Api).AddScope(new Scope(Scopes.Games)).Build(); // create an instance of Google API client and specify the Play services // and scopes to use. In this example, we specify that the app wants // access to the Games, Plus, and Cloud Save services and scopes. GoogleApiClientBuilder builder = new GoogleApiClientBuilder(this, this, this); builder.AddApi(GamesClass.Api).AddScope(GamesClass.ScopeGames); mGoogleApiClient = builder.Build(); mMatch = new MatchInfo(this); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // Get our button from the layout resource, // and attach an event to it Button button = FindViewById <Button>(Resource.Id.myButton); button.Click += delegate { mMatch.IncrementClickCount(); }; Button StartMatch = FindViewById <Button>(Resource.Id.StartMatchBtn); StartMatch.Click += delegate { if (!mGoogleApiClient.IsConnected) { Toast.MakeText(this, "Sign In First", ToastLength.Long).Show(); return; } Toast.MakeText(this, "StartMatch.Click", ToastLength.Long).Show(); Intent intent = GamesClass.TurnBasedMultiplayer.GetSelectOpponentsIntent(mGoogleApiClient, 1, 1, true); StartActivityForResult(intent, RC_SELECT_PLAYERS); }; Button InboxButton = FindViewById <Button>(Resource.Id.InboxBtn); InboxButton.Click += delegate { if (!mGoogleApiClient.IsConnected) { Toast.MakeText(this, "Sign In First", ToastLength.Long).Show(); return; } Toast.MakeText(this, "InboxButton.Click", ToastLength.Long).Show(); Intent intent = GamesClass.TurnBasedMultiplayer.GetInboxIntent(mGoogleApiClient); StartActivityForResult(intent, RC_OPEN_INBOX); }; Button TurnButton = FindViewById <Button>(Resource.Id.TakeTurnBtn); TurnButton.Click += delegate { mMatch.EndTurn(); }; Button SingInButton = FindViewById <Button>(Resource.Id.SignInBtn); SingInButton.Click += delegate { if (mGoogleApiClient.IsConnected || mGoogleApiClient.IsConnecting) { Toast.MakeText(this, "Already Signed In.", ToastLength.Long).Show(); return; } mGoogleApiClient.Connect(); }; Button SingOutButton = FindViewById <Button>(Resource.Id.SignOutBtn); SingOutButton.Click += delegate { if (mGoogleApiClient == null) { Toast.MakeText(this, "Google API is Null. Fatal Error.", ToastLength.Long).Show(); return; } if (!mGoogleApiClient.IsConnected && !mGoogleApiClient.IsConnecting) { Toast.MakeText(this, "Already Signed Out.", ToastLength.Long).Show(); return; } mGoogleApiClient.Disconnect(); }; }
private IGoogleApiClient PrepClient() { if (apiClient == null) { GoogleApiClientBuilder builder = new GoogleApiClientBuilder(this) .AddConnectionCallbacks(this) .AddOnConnectionFailedListener(this) .AddApi(LocationServices.Api); apiClient = builder.Build(); } return apiClient; }