Commit dfa70644 authored by aringot's avatar aringot

Fixed bug: alert did not pop up after a detection while app visible

parent 9b195796
......@@ -459,23 +459,40 @@ public class MainActivity extends BaseActivity implements Scan.DetectionListener
Manifest.permission.ACCESS_FINE_LOCATION);
if((!(isGPSEnabled && gpsEnabled) && !(isNetworkEnabled && networkEnabled)) || status != PackageManager.PERMISSION_GRANTED){
btnAlertSpoof.setEnabled(false);
btnAlertDismissAlways.setEnabled(false);
txtNoLocation.setText(R.string.on_alert_no_location_message);
runOnUiThread(new Runnable() {
@Override
public void run() {
btnAlertSpoof.setEnabled(false);
btnAlertDismissAlways.setEnabled(false);
txtNoLocation.setText(R.string.on_alert_no_location_message);
}
});
}else if(!saveJsonFile){
btnAlertSpoof.setEnabled(false);
btnAlertDismissAlways.setEnabled(false);
txtNoLocation.setText(R.string.on_alert_no_location_message);
runOnUiThread(new Runnable() {
@Override
public void run() {
btnAlertSpoof.setEnabled(false);
btnAlertDismissAlways.setEnabled(false);
txtNoLocation.setText(R.string.alert_no_json_file_message);
}
});
}else{
btnAlertSpoof.setEnabled(true);
btnAlertDismissAlways.setEnabled(true);
runOnUiThread(new Runnable() {
@Override
public void run() {
btnAlertSpoof.setEnabled(true);
btnAlertDismissAlways.setEnabled(true);
txtNoLocation.setText("");
}
});
}
sigType = signalType; //set the technology variable to the latest detected one
boolean activityExists = settings.getBoolean("active", false);
if (activityExists) {
uiHandler.post(displayAlert);
runOnUiThread(displayAlert);
//uiHandler.post(displayAlert); NOTE: runOnUiThread will execute code directly, not post
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment