Posted By

akus85 on 06/14/12


Tagged

GPS android


Versions (?)

GpsOn


 / Published in: Java
 

  1. private void Check(){
  2. String provider = Settings.Secure.getString(getContentResolver(),
  3. Settings.Secure.LOCATION_PROVIDERS_ALLOWED);
  4. if(!provider.contains("gps")){ // if gps is disabled
  5. new AlertDialog.Builder( this )
  6. .setTitle( "Turn GPS" )
  7. .setMessage( "The GPS is off you activate it ?" )
  8. .setPositiveButton( "Yes", new DialogInterface.OnClickListener() {
  9. public void onClick(DialogInterface dialog, int which) {
  10. startActivity(new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS));
  11. }})
  12. .setNegativeButton( "No", new DialogInterface.OnClickListener() {
  13. public void onClick(DialogInterface dialog, int which) {
  14. }} )
  15. .show();
  16. }
  17. }
  18.  

Report this snippet  

You need to login to post a comment.