Exemplo n.º 1
0
        public AndroidDatabaseProvider(Activity activity)
        {
            this.activity = activity;

            GoogleApiAvailability googleApiAvailability = GoogleApiAvailability.Instance;

            if (googleApiAvailability.IsGooglePlayServicesAvailable(activity) == ConnectionResult.Success)
            {
                string accountName;
                using (ISharedPreferences settings = activity.GetSharedPreferences(SETTINGS_NAME, FileCreationMode.Private)) {
                    accountName = settings.GetString(SETTINGS_STRING_ACCOUNTNAME, string.Empty);
                }

                global::Android.Widget.Toast.MakeText(activity, "awdawd", Android.Widget.ToastLength.Short);

                GoogleApiClient.Builder builder = new GoogleApiClient.Builder(activity, this, this)
                                                  .AddApi(GamesClass.API)
                                                  .AddScope(GamesClass.ScopeGames)
                                                  .AddApi(DriveClass.API)
                                                  .AddScope(DriveClass.ScopeAppfolder);

                if (!string.IsNullOrEmpty(accountName))
                {
                    builder.SetAccountName(accountName);
                }
                _GoogleApiClient = builder.Build( );

                _GoogleApiClient.Connect( );
            }

            localStateDatabase = activity.GetSharedPreferences(LOCAL_COPY_STATE_NAME, FileCreationMode.Private);
        }
Exemplo n.º 2
0
        public bool ServicosGooglePlayEstaoDisponiveis()
        {
            GoogleApiAvailability disponibilidadeApiGoogle = GoogleApiAvailability.Instance;

            ResConexao = disponibilidadeApiGoogle.IsGooglePlayServicesAvailable(contexto);

            return(ResConexao == ConnectionResult.Success);
        }
        private bool IsPlayServicesAvailable()
        {
            int num = ((Zzc)GoogleApiAvailability.get_Instance()).IsGooglePlayServicesAvailable(Application.get_Context());

            if (num == 0)
            {
                return(true);
            }
            if (!((Zzc)GoogleApiAvailability.get_Instance()).IsUserResolvableError(num))
            {
                CrossMobileAnalytics.Current.TrackException(new Exception("This device is not supported"), (IDictionary <string, string>)null, nameof(IsPlayServicesAvailable), "/Users/admin/myagent/macMiniBlack3/_work/2/s/eKreta.Mobile/eKreta.Mobile/eKreta.Mobile.Android/Platform/PushNotification/AndroidPushNotificationHandler.cs", 73);
            }
            return(false);
        }
Exemplo n.º 4
0
        private bool CheckPlayServices()
        {
            GoogleApiAvailability googleAPI = GoogleApiAvailability.Instance;
            int result = googleAPI.IsGooglePlayServicesAvailable(this);

            if (result != ConnectionResult.Success)
            {
                if (googleAPI.IsUserResolvableError(result))
                {
                    googleAPI.GetErrorDialog(this, result,
                                             PLAY_SERVICES_RESOLUTION_REQUEST).Show();
                }

                return(false);
            }

            return(true);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Check the device to make sure it has the Google Play Services APK. If
        /// it doesn't, display a dialog that allows users to download the APK from
        /// the Google Play Store or enable it in the device's system settings.
        /// </summary>
        private bool checkPlayServices()
        {
            GoogleApiAvailability apiAvailability = GoogleApiAvailability.Instance;
            int resultCode = apiAvailability.isGooglePlayServicesAvailable(this);

            if (resultCode != ConnectionResult.SUCCESS)
            {
                if (apiAvailability.isUserResolvableError(resultCode))
                {
                    apiAvailability.getErrorDialog(this, resultCode, PLAY_SERVICES_RESOLUTION_REQUEST).show();
                }
                else
                {
                    Log.e(TAG, "This device is not supported.");
                    finish();
                }
                return(false);
            }
            return(true);
        }