Пример #1
0
        private async Task HasLocationPermissionsAsync()
        {
            if (IsLocationEnabled())
            {
                return;
            }

            await DialogUtils.DisplayDialogAsync(
                Current.Activity,
                new DialogViewModel
            {
                Title    = "PERMISSION_LOCATION_NEEDED_TITLE".Translate(),
                Body     = "PERMISSION_ENABLE_LOCATION_AND_BLUETOOTH".Translate(),
                OkBtnTxt = Current.Activity.Resources.GetString(Android.Resource.String.Ok)
            },
                GoToLocationSettings);
        }
Пример #2
0
        private async Task <bool> HasBluetoothAdapter()
        {
            if (BluetoothAdapter.DefaultAdapter != null)
            {
                return(true);
            }

            await DialogUtils.DisplayDialogAsync(
                Current.Activity,
                new DialogViewModel()
            {
                Title    = "NO_BLUETOOTH_TITLE".Translate(),
                Body     = "NO_BLUETOOTH_MSG".Translate(),
                OkBtnTxt = Current.Activity.Resources.GetString(Android.Resource.String.Ok)
            });

            return(false);
        }
Пример #3
0
        private async Task HasBluetoothSupportAsync()
        {
            if (await HasBluetoothAdapter() && BluetoothAdapter.DefaultAdapter.IsEnabled)
            {
                return;
            }

            await DialogUtils.DisplayDialogAsync(
                Current.Activity,
                new DialogViewModel()
            {
                Title        = "PERMISSION_BLUETOOTH_NEEDED_TITLE".Translate(),
                Body         = "PERMISSION_ENABLE_LOCATION_AND_BLUETOOTH".Translate(),
                OkBtnTxt     = Current.Activity.Resources.GetString(Android.Resource.String.Ok),
                CancelbtnTxt = Current.Activity.Resources.GetString(Android.Resource.String.Cancel)
            },
                GoToBluetoothSettings,
                CancelTask);
        }