If anyone whats to know, I got this working by adding a Boolean called isGPSEnabled and getting it to check the status of GPS. Then I used and if/else to call the onProviderDisabled method.
The OnCreate method is below.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mapSettings();
LocationManager lm = (LocationManager) getSystemService(LOCATION_SERVICE);
Boolean isGPSEnabled = lm .isProviderEnabled(LocationManager.GPS_PROVIDER);;
String provider = lm.getBestProvider(new Criteria(), true);
if(isGPSEnabled == true)
{
}
else
{
onProviderDisabled(provider);
}