Exemple #1
0
        public void RegisterServiceForPlaform(object sender)
        {
            _geoList = new List <IGeofence>();
            _geofencePendingIntent = null;

            PopulateGeofenceList();

            _context = sender as Context;
            GoogleApiClient.IConnectionCallbacks        connectionCallback       = this as GoogleApiClient.IConnectionCallbacks;
            GoogleApiClient.IOnConnectionFailedListener connectionFailedCallback = sender as GoogleApiClient.IOnConnectionFailedListener;
            _googleApiClient = new GoogleApiClient.Builder(_context)
                               .AddConnectionCallbacks(connectionCallback)
                               .AddOnConnectionFailedListener(connectionFailedCallback)
                               .AddApi(LocationServices.API)
                               .Build();
        }
Exemple #2
0
        public GoogleApiClient GoogleLogin(Context context, FragmentActivity fragmentActivity, GoogleApiClient.IOnConnectionFailedListener onConnectionFailedListener, GoogleApiClient.IConnectionCallbacks onconnectionCallbacks)
        {
            GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DefaultSignIn)
                                      .RequestEmail()
                                      .Build();
            GoogleApiClient mgoogleApiClient = new GoogleApiClient.Builder(context)
                                               .EnableAutoManage(fragmentActivity, onConnectionFailedListener)
                                               .AddApi(Auth.GOOGLE_SIGN_IN_API, gso)
                                               .AddConnectionCallbacks(onconnectionCallbacks)
                                               .Build();

            return(mgoogleApiClient);
        }