How to Launch Browser in 3rd edition
Article Metadata
Headers Required:
#include <apgtask.h>
#include <apgcli.h>
Library Needed:
LIBRARY apgrfx.libSource:
// ----------------------------------------------------
// CBrowserAppUi::LaunchBrowserL(const TDesC& aUrl)
// Used for launching the default browser with provided url.
// ----------------------------------------------------
//
void CBrowserAppUi::LaunchBrowserL(const TDesC& aUrl)
{
const TInt KWmlBrowserUid = 0x10008D39;
TUid id( TUid::Uid( KWmlBrowserUid ) );
TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
TApaTask task = taskList.FindApp( id );
if ( task.Exists() )
{
HBufC8* param = HBufC8::NewLC( aUrl.Length() + 2);
//"4 " is to Start/Continue the browser specifying a URL
param->Des().Append(_L("4 "));
param->Des().Append(aUrl);
task.SendMessage( TUid::Uid( 0 ), *param ); // Uid is not used
CleanupStack::PopAndDestroy(param);
}
else
{
HBufC16* param = HBufC16::NewLC( aUrl.Length() + 2);
//"4 " is to Start/Continue the browser specifying a URL
param->Des().Append(_L("4 "));
param->Des().Append(aUrl);
RApaLsSession appArcSession;
// connect to AppArc server
User::LeaveIfError(appArcSession.Connect());
TThreadId id;
appArcSession.StartDocument( *param, TUid::Uid( KWmlBrowserUid)
, id );
appArcSession.Close();
CleanupStack::PopAndDestroy(param);
}
}
Additional information about the parameters that are passed as command line arguments when launching the Browser:
1. Start/Continue the browser and nothing is specified (the default case)
Parameter = <Any text>
2. Start/Continue the browser specifying a Bookmark
Parameter = 1+<Space>+<Uid of the Bookmark>
3. Start/Continue the browser specifying a Saved deck
Parameter = 2+<Space>+<Uid of the Saved deck>
4. Start/Continue the browser specifying a URL
Parameter = 4+ <Space>+<Url>
5. Start/Continue the browser specifying a URL and an Access Point
Parameter = 4+<Space>+<Url>+<Space>+<Uid of Ap>
Note: the UID should have WAP ID value, not IAP ID
6. Start/Continue the browser with the start page. (Used when starting the browser with a long press of 0 in the Idle state of the phone.
Parameter = 5
7. Start/Continue the browser specifying a Bookmark folder
Parameter = 6+ <Space>+<Uid of the Folder>


When it launched, it opened a new window and when it reaches 5 windows, it shows an error. Any workaround?
For the above issue - what was the error code shown?
This snippet doe snot consider that in v3 initial version devices we can have 2 Browsers one OSS and one WAP browser that might create problems some times with websites opened in wrong browsers. But the explanation about arguments is very useful. --skumar_rao 18:17, 10 September 2009 (UTC)
Line
task.SendMessage( TUid::Uid( 0 ), *param ); // Uid is not used
Requires capability SwEvent in my 5800. Also on the N97, N97-mini and X6 I have tested through RDA. [Juan Noguera] 19:13 03 Dec 2009 (CET)