Q:

Asking the user to activate its GPS when using com.google.android.gms.location.LocationListener

I have studied all the post related to this and read a lot of documentation but still I don't know what to do. When I run the app on my phone the location button is added but nothing happens when I push it, if the GPS is not enabled. When I do enable it (manually, not being promted or anything) it works perfectly.
What I want to do is that when the user pushes the standard location button a new custom intent should be called. Something like this:
    if (mLastLocation == null) {

    LayoutInflater inflater = getLayoutInflater();
    @SuppressLint("InflateParams") View layout = inflater.inflate(R.layout.toast_gps_view, null);

    Toast toast = new Toast(getApplicationContext());
toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
        toast.setDuration(Toast.LENGTH_LONG);
        toast.setView(layout);
        toast.show();

        Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
        startActivity(intent);

When I was importing the android.location.LocationListener; the callback onProviderDisabled method was called and I could add my code there, but now using the com.google.android.gms.location.LocationListener that method is not overwritten anymore.
  So what do I have to do in order for the user to be promted to activate the GPS?

A:

Finally found out how to do it. Here is how I did it:
  mMap.setOnMyLocationButtonClickListener(new GoogleMap.OnMyLocationButtonClickListener() {
            @Override
            public boolean onMyLocationButtonClick() {

                LocationManager service = (LocationManager) getSystemService(LOCATION_SERVICE);

                boolean enabledGPS = service
                        .isProviderEnabled(LocationManager.GPS_PROVIDER);
                boolean enabledWiFi = service
                        .isProviderEnabled(LocationManager.NETWORK_PROVIDER);

                if (!enabledGPS) {

                    LayoutInflater inflater = getLayoutInflater();
                    @SuppressLint("InflateParams") View layout = inflater.inflate(R.layout.toast_gps_view, null);

                    Toast toast = new Toast(getApplicationContext());
                    toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
                    toast.setDuration(Toast.LENGTH_LONG);
                    toast.setView(layout);
                    toast.show();

                    Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
                    startActivity(intent);

                } else if (!enabledWiFi) {

                    Toast.makeText(getApplicationContext(),
                            "Network signal or WiFi connections not found",
                            Toast.LENGTH_LONG).show();
                    Intent intent = new Intent(
                            Settings.ACTION_LOCATION_SOURCE_SETTINGS);
                    startActivity(intent);

                }

                return false;
            }
        });

