Make phone browser open a URL on Symbian S60 3rd Ed programmatically

Posted by ardsrk on Stack Overflow See other posts from Stack Overflow or by ardsrk
Published on 2010-05-24T09:27:01Z Indexed on 2010/05/24 9:31 UTC
Read the original article Hit count: 243

Filed under:
|
|

On clicking a URL displayed in my application running on a Symbian S60 3rd Edition device should make the phone browser ( which is already open ) open the specified URL.

Here is the code:

_LIT( KUrlPrefix,"4 " )

void CMunduIMAppUi::OpenInBrowser(const TDesC& aUrl)
    {
    HBufC *url = NULL;
    const TInt KWmlBrowserUid =0x10008D39; 
    TUid id( TUid::Uid( KWmlBrowserUid ) );
    TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
    TApaTask task = taskList.FindApp( id );

    // Checks if the browser is already open
    if ( task.Exists() )
        {
        HBufC8* parameter = HBufC8::NewL( aUrl.Length()+ KUrlPrefix().Length());
        parameter->Des().Copy(KUrlPrefix);
        parameter->Des().Append(aUrl);

        task.BringToForeground();
        task.SendMessage(TUid::Uid(0), *parameter); // UID not used

        delete parameter;
        parameter = NULL;
        }
    }

When I use this code to open a URL the browser comes to the foreground but does not get directed to the URL.

I suspect something is wrong in SendMessage call that is called after the browser is brought to foreground:

task.SendMessage(TUid::Uid(0), *parameter); // UID not used

© Stack Overflow or respective owner

Related posts about symbian

Related posts about s60