위치를 확인하려면 서비스를 사용하거나지 않은 안드로이드 기기

0

질문

죄송에 대한 요청이 있지만 나는 개발자를 위한 안드로이드 응용 프로그램입니다. 제가 물어보고 싶은 경우에는 사용자 정의 지리적 위치 안드로이드 앱 수 있는 코드에서는 방식으로 사용자가 응용 프로그램을 실행하고 감지하는 장치의 위치 서비스가,그것은으로 표시됩니다 프롬프트 또는 응용 프로그램이 진행될 때까지 위치 서비스에 사용자가 수동으로?

우리가 사용하는 모바일 기기 관리(mdm)을 관리하는 안드로이드 모바일 장치지만 mdm 하지 않았을 적용할 수 있는 기능이 위치 서비스 설정합니다.

사용자 정의 지리적 위치 안드로이드 앱 위치 서비스를 활성화를 제대로 작동합니다.

android geolocation gps location
2021-11-17 13:42:19
1

최고의 응답

0

당신은 여부를 확인할 수 있습 GPS 를 사용하고 메시지가 표시되지 않은 경우 사용

        LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);

        if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {

            //here do what you want when the GPS service is enabled

            Toast.makeText(MainActivity.this, "is enable", Toast.LENGTH_SHORT).show();

        } else {

            MaterialAlertDialogBuilder locationDialog = new MaterialAlertDialogBuilder(MainActivity.this);
            locationDialog.setTitle("Attention");
            locationDialog.setMessage("Location settings must be enabled from the settings to use the application");
            locationDialog.setCancelable(false);
            locationDialog.setPositiveButton("Open settings", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialogInterface, int i) {
                    Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
                    startActivity(intent);
                }
            });
            locationDialog.create().show();
        }

    }
}
2021-11-17 16:06:51

다른 언어로

이 페이지는 다른 언어로되어 있습니다

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................