List of usage examples for android.provider Settings ACTION_LOCATION_SOURCE_SETTINGS
String ACTION_LOCATION_SOURCE_SETTINGS
To view the source code for android.provider Settings ACTION_LOCATION_SOURCE_SETTINGS.
Click Source Link
From source file:me.ububble.speakall.fragment.ConversationGroupFragment.java
public void checkCountryLocation(final boolean gpsProvider, final boolean netProvider) { getActivity().runOnUiThread(new Runnable() { @Override/*w w w .jav a2 s . c om*/ public void run() { boolean gpsEnabled = false; boolean networkEnabled = false; if (gpsProvider) { gpsEnabled = milocManager.isProviderEnabled(LocationManager.GPS_PROVIDER); } if (netProvider) { networkEnabled = milocManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER); } if (gpsProvider && netProvider) { if (!gpsEnabled && !networkEnabled) { LayoutInflater dialogInflater = (LayoutInflater) activity .getSystemService(Context.LAYOUT_INFLATER_SERVICE); dialogView = dialogInflater.inflate(R.layout.null_contact_dialog, null); TextView mensaje = (TextView) dialogView.findViewById(R.id.dialog_add_contact); mensaje.setText(getString(R.string.location_services)); final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(activity) .setView(dialogView).setCancelable(true) .setPositiveButton(R.string.add_contact_yes, null) .setNegativeButton(R.string.add_contact_no, null); finderDialog = dialogBuilder.show(); finderDialog.setCanceledOnTouchOutside(true); finderDialog.getButton(DialogInterface.BUTTON_POSITIVE) .setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finderDialog.dismiss(); System.gc(); dontClose = true; ((MainActivity) activity).dontClose = true; Intent intent = new Intent( android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS); startActivityForResult(intent, 45); } }); finderDialog.getButton(DialogInterface.BUTTON_NEGATIVE) .setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finderDialog.dismiss(); } }); } else { milocManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, ConversationGroupFragment.this); milocManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, ConversationGroupFragment.this); } } } }); }