Then I beleive that u are not updating the comms data base, that will bring your created AP to the list. Well here is a sample code. This will create the APN for you.
Code:
CCommsDatabase* db = CCommsDatabase::NewL();
CleanupStack::PushL(db);
TInt err = db->BeginTransaction();
// Create a wlan AP and fill its mandatory fields.
CApAccessPointItem* wlanAp = CApAccessPointItem::NewLC();
CApAccessPointItem* wlanNewItem=CApAccessPointItem::NewLC();
wlanAp->SetNamesL(_L("MyApn"));
wlanAp->SetBearerTypeL(EApBearerTypeWLAN);
wlanAp->WriteTextL(EApWlanNetworkName, _L("MySSid")); // Give corrct Data as per the router configuration //L!nkSys@MdpNok!a
//Lan network mode should be 1 for infrastructure, 0 for adhoc
wlanAp->WriteUint(EApWlanNetworkMode,0);
TBool val =ETrue;
TUint32 newalanid;
CApDataHandler* handler = CApDataHandler::NewLC(*db);
TUint32 apid;
apid = handler->CreateFromDataL(*wlanAp);
handler->UpdateAccessPointDataL(*wlanAp,val);
handler->AccessPointDataL(apid,*wlanNewItem);
wlanNewItem->ReadUint( EApIapServiceId, newalanid );
TBuf<50> ibuff;
wlanNewItem->ReadTextL( EApWlanNetworkName, ibuff );
CCommsDbTableView* wLanServiceTable = db->OpenViewMatchingUintLC( TPtrC( WLAN_SERVICE ), TPtrC( WLAN_SERVICE_ID ), newalanid );
errorCode = wLanServiceTable->GotoFirstRecord();
if ( errorCode == KErrNone )
{
wLanServiceTable->UpdateRecord();
}
else
{
TUint32 dummyUid( 10 ); //KUidNone
User::LeaveIfError( wLanServiceTable->InsertRecord( dummyUid ) );
wLanServiceTable->WriteUintL( TPtrC( WLAN_SERVICE_ID ), apid );
}
wLanServiceTable->PutRecordChanges();
err = db->CommitTransaction();
CleanupStack::PopAndDestroy(5);
Regards,