Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- LocationManager locationManager = (LocationManager) getActivity().getSystemService(LOCATION_SERVICE);
- if ( !locationManager.isProviderEnabled( LocationManager.GPS_PROVIDER ) ) {
- AlertNoGps();
- }
- private void AlertNoGps() {
- AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
- builder.setMessage("El sistema GPS esta desactivado, ¿Desea activarlo?")
- .setCancelable(false)
- .setPositiveButton("Si", new DialogInterface.OnClickListener() {
- public void onClick(@SuppressWarnings("unused") final DialogInterface dialog, @SuppressWarnings("unused") final int id) {
- startActivity(new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS));
- }
- })
- .setNegativeButton("No", new DialogInterface.OnClickListener() {
- public void onClick(final DialogInterface dialog, @SuppressWarnings("unused") final int id) {
- dialog.cancel();
- }
- });
- alert = builder.create();
- alert.show();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement