ESP32 - smart config in a separate task

Dear All,
I intend to run "Smart Config" in a separate task.

Reason : Assuming, there is a disconnection due to 'changed SSID/Password', the User should be able to use 'smart config' app to update the latest "SSID/Password" to the board...in my case ESP32

Code Snippet:

//=====================================================
// WIFI DISCONNECT EVENT HANDLER
//=====================================================

void WiFiDisconnect(WiFiEvent_t event, WiFiEventInfo_t info)
{

WiFi.begin( SSID, PASSWORD );
if((WiFi.status() == WL_CONNECTED))
Serial.printf("\nReconnected WiFi.. \n\n");
}

//=====================================================
// SMART CONFIG CHECK
//=====================================================
void smartConfigCheck( void * pvParameters )
{
while(1)
{
delay(1000);
Serial.printf("smartConfigCheck....\n");

if((WiFi.status() != WL_CONNECTED))
{
if (!initSmartConfig())
{
delay( 1);
Serial.printf("\nsmartConfigCheck : Did not receive Correct SSID/Password \n");

}
}
}
vTaskDelete( NULL );
}

//=====================================================
// Smart Config
//=====================================================
bool initSmartConfig()
{
int loopCounter = 0;

Serial.printf( "\n\nEntering SmartConfig \n\n" );
WiFi.mode( WIFI_AP_STA ); //Init WiFi, start SmartConfig
WiFi.beginSmartConfig();

while (!WiFi.smartConfigDone() && SCcount < 1500)
{
....some code

}


My Findings:

I tried the above task, but when I manually change the Password of my Router, it just disconnects..
My code does not enter the 'smart Config Check' task..

Any pointers would be of great hep..

Cheers,
Hemendra