How to Invoke the browser from your app
Got the following code snippet from forum nokia wiki , one thing to take care of is that you need the SwEvent capability when there is a browser already running!
void CBrowserAppUi::LaunchBrowserL(const TDesC& aUrl)
{
const TInt KBrowserUid = 0×10008D39;
TUid id( TUid::Uid( KBrowserUid ) );
TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
TApaTask task = taskList.FindApp( id );
if ( task.Exists() )
{
HBufC8* param = HBufC8::NewLC( aUrl.Length() + 2);
param->Des().Append(_L(“4 “));
param->Des().Append(aUrl);
//Need the WsEvent Capability
task.SendMessage( TUid::Uid( 0 ), *param ); // Uid is not used
CleanupStack::PopAndDestroy(param);
}
else
{
HBufC16* param = HBufC16::NewLC( aUrl.Length() + 2);
param->Des().Append(_L(“4 “));
param->Des().Append(aUrl);
RApaLsSession appArcSession;
User::LeaveIfError(appArcSession.Connect());
TThreadId id;
appArcSession.StartDocument( *param, TUid::Uid( KBrowserUid), id );
appArcSession.Close();
CleanupStack::PopAndDestroy(param);
}
}
Popularity: 26% [?]
Add comment 06月 14th, 2008