I wanted to launch a web browser with a page opened by default. The application works fine. But the url is openeing in a popup in the browser. So if I open the url more than 5 times it does not allow me to open it as the maximum no of opened popup is 5 in my Nokia E71.
I used the following code
HBufC* param = HBufC::NewLC( 20 );
param->Des().Copy( _L( "4 http://www.yahoo.com/" ) );
const TInt KWmlBrowserUid = 0x10008D39;
TUid id( TUid::Uid( KWmlBrowserUid ) );
TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
TApaTask task = taskList.FindApp( id );
if ( task.Exists() )
{
task.BringToForeground();
HBufC8* param8 = HBufC8::NewLC( param->Length() );
param8->Des().Append( *param );
task.SendMessage( TUid::Uid( 0 ), *param8 ); // Uid is not used
CleanupStack::PopAndDestroy();
}
else
{
RApaLsSession appArcSession;
User::LeaveIfError(appArcSession.Connect()); // connect to AppArc server
TThreadId id;
appArcSession.StartDocument( *param, TUid::Uid( KWmlBrowserUid ), id );
appArcSession.Close();
}
CleanupStack::PopAndDestroy(); // param
I even tried to close the browser and restart the task, but failed to do so. I used the following code
const TInt KWmlBrowserUid = 0x10008D39;// 0x1020724D for S60 3rd Ed
TUid taskId( TUid::Uid( KWmlBrowserUid ) );
TApaTaskList taskList( iEikonEnv->WsSession() );
TApaTask task = taskList.FindApp( taskId );
TBool taskClosed = ETrue;
if ( task.Exists() )
{
taskClosed = EFalse;
task.BringToForeground();
//task.KillTask();
task.EndTask();
//task.SendSystemEvent(EApaSystemEventShutdown);
for(int i=0;i<500;i++)
{
DoSomeOperation();
taskClosed = ETrue;
TApaTaskList taskList2( iEikonEnv->WsSession() );
TApaTask task2 = taskList2.FindApp( taskId );
if(!task2.Exists())
{
taskClosed = ETrue;
break;
}
}
}
if(!taskClosed)
return;
....the code for openeing a new browser continues here
With this code the browser is closed, but it does not restart in the same session.
I saw the cellspotting(http://www.cellspotting.com) application, it opens the browser more than 5 times without any problem.
I tried with Nokia Browser Launch API, but when I restart my application without closing it, the browser is in front of the application which is not the required feature of the application.
Can anybody help me?

Reply With Quote

