Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.testcase.callreceiver;
- import android.app.Activity;
- import android.app.AlertDialog;
- import android.content.Context;
- import android.content.DialogInterface;
- import android.content.Intent;
- import android.provider.Settings;
- public class CheckForGPS extends Activity {
- Context context;
- void buildAlertMessageNoGps(Context context) {
- final AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setMessage("Yout GPS seems to be disabled, do you want to enable it?")
- .setCancelable(false)
- .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
- public void onClick(final DialogInterface dialog, final int id) {
- startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS));
- }
- })
- .setNegativeButton("No", new DialogInterface.OnClickListener() {
- public void onClick(final DialogInterface dialog, final int id) {
- dialog.cancel();
- }
- });
- final AlertDialog alert = builder.create();
- alert.show();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement