Hello,

I have an app that uses HTTP transaction APIs to contact a server.Suppose I set the default connection as an option that is not set(for ex WAP Services) then RConnection::Start completes with -1(as expected).

In the RunL I am using CCmApplicationSettingsUi so that if I get an error while initial connection, a prompt is thrown to the user to select the available APs, though the connection succeeds after user selects a proper AP, MHFRunL completes with EUnrecoverableError and then EFailed.

If I have set the default connection as an AP that is available then there is no issue and everything works as expected.

Below is my RunL

void CHttpEngine::RunL()
{
TInt statusCode = iStatus.Int();

qDebug()<<"Status code"<<statusCode;
if (!iConnectionSetupDone && statusCode == KErrNone)
{
// Connection done ok
iConnectionSetupDone = ETrue;
// Start selected HTTP action
switch (iEngineState)
{
case EIdle:
{
CancelTransaction();
break;
}
case EGet:
{
DoHTTPGetL();
break;
}
case EPost:
{
DoHTTPPostL();
break;
}
};
}
else if(statusCode != KErrNone)
{
if(failed )
{
failed = false;
emit qPtr->failed();
}

// Default connection failed , try with user input.
TCmSettingSelection userSelection;
CCmApplicationSettingsUi* settings = CCmApplicationSettingsUi::NewL();
CleanupStack::PushL(settings);
TUint listedItems = CMManager::EShowAlwaysAsk |
CMManager::EShowDefaultConnection |
CMManager::EShowDestinations |
CMManager::EShowConnectionMethods;
TBearerFilterArray filter;
TBool selected = settings->RunApplicationSettingsL(userSelection,listedItems,filter);
CleanupStack::PopAndDestroy(settings);
failed = true;

// Check selection
if (selected)
{
switch (userSelection.iResult)
{
case CMManager::EDestination:
{
TConnSnapPref prefs;
prefs.SetSnap(userSelection.iId);
iConnection.Start(prefs, iStatus);
break;
}
case CMManager::EConnectionMethod:
{
TCommDbConnPref prefs;
prefs.SetIapId(userSelection.iId);
prefs.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
iConnection.Start(prefs, iStatus);
break;
}
case CMManager::EDefaultConnection:
{
iConnection.Start(iStatus);
break;
}
default: // EAlwaysAsk
{
TCommDbConnPref prefs;
prefs.SetDialogPreference(ECommDbDialogPrefPrompt);
iConnection.Start(prefs, iStatus);
}
}
SetActive();
}
else
emit qPtr->failed();
}
}