SHARE
TWEET

Untitled

a guest Jul 17th, 2017 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.testcase.callreceiver;
  2.  
  3. import android.app.Activity;
  4. import android.app.AlertDialog;
  5. import android.content.Context;
  6. import android.content.DialogInterface;
  7. import android.content.Intent;
  8. import android.provider.Settings;
  9.  
  10. public class CheckForGPS extends Activity {
  11.     Context context;
  12.       void buildAlertMessageNoGps(Context context) {
  13.         final AlertDialog.Builder builder = new AlertDialog.Builder(this);
  14.         builder.setMessage("Yout GPS seems to be disabled, do you want to enable it?")
  15.                .setCancelable(false)
  16.                .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
  17.                    public void onClick(final DialogInterface dialog, final int id) {
  18.                        startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS));
  19.                    }
  20.                })
  21.                .setNegativeButton("No", new DialogInterface.OnClickListener() {
  22.                    public void onClick(final DialogInterface dialog, final int id) {
  23.                         dialog.cancel();
  24.                    }
  25.                });
  26.         final AlertDialog alert = builder.create();
  27.         alert.show();
  28.     }
  29. }
RAW Paste Data
Top