×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 29
  1. #1
    Regular Contributor
    Join Date
    Mar 2003
    Location
    UK
    Posts
    159

    launching wap browser with URL

    I'm trying to launch the WAP Browser (wmlBrowser.app on the device, browser.app on the emulator) at a local file; and I'm having problems. In fact I'm having problems launching it with a URL at the moment...

    The code I've found (from here somewhere) is:

    void CMyDocument::LaunchURL(CMyString& aLink)
    {
    #ifdef __WINS__
    _LIT(KToDoFileName, "z:\\System\\Apps\\Browser\\Browser.app");
    #else
    _LIT(KToDoFileName, "z:\\System\\Apps\\WmlBrowser\\WmlBrowser.app");
    #endif

    CApaCommandLine* cmdLine=CApaCommandLine::NewLC();
    cmdLine->SetCommandL(EApaCommandOpen);
    cmdLine->SetLibraryNameL(KToDoFileName);

    TPtr url((unsigned short *)aLink.Cstr(), aLink.Size());
    HBufC * arg = HBufC::NewLC(url.Length()+3);
    *arg = _L("4 ");
    arg->Des().Append(url);

    cmdLine->SetDocumentNameL(*arg);
    EikDll::StartAppL(*cmdLine);
    CleanupStack::PopAndDestroy(2); // cmdLine, arg
    }

    This launches the WAP browser, and seems to try to launch the URL passed in - but (even before trying to connect) says that the URL is invalid. Does anyone know what format is valid? I've tried a few variations but the error always pops up saying "check url"

    And beyond that... does anyone know how (if?) I can point it at a .wml deck on the c: drive?

    And finally... does anyone know what the other launch codes are? '4' in the above code seems to be the magic number for launching a URL... so what about 0, 1,2 and 3???


    Cheers
    Russell

  2. #2
    Regular Contributor
    Join Date
    Mar 2003
    Location
    UK
    Posts
    159
    I've been doing some more investigation... and have got a tiny bit further, maybe.

    If I use quotes around the URL in the document, things change. So I use:

    "4 \"http://wap.yahoo.com/\""

    The emulator shows the name as it's passed in (in an info message thingy), and the phone doesn't complain any more... but it doesn't actually make the brwoser launch anything...

    Am I realy going to have to mask the browser app with my own and grab the command line when it's launched from the SMS app?????

  3. #3
    Registered User
    Join Date
    Mar 2003
    Posts
    12
    Try removing the " \" " before the http. I got this to work on the 3650 device. Didn't try it in the emulator.

    TFileName AppToLaunch;
    TBuf<100> iDoc;
    AppToLaunch = \\system\\apps\\browser\\browser.app;
    iDoc = _L("4 http://wap.yahoo.com/");

    CApaCommandLine* cmdLine = CApaCommandLine::NewLC();
    cmdLine->SetLibraryNameL(AppToLaunch);

    if (iDoc != _L(""))
    cmdLine->SetDocumentNameL(iDoc);

    cmdLine->SetCommandL(EApaCommandOpen);
    RApaLsSession ls;
    User::LeaveIfError(ls.Connect());
    handle = ls.Handle();
    ls.EmbeddableAppCount(initialAppCount);
    CleanupClosePushL(ls);
    User::LeaveIfError(ls.StartApp(*cmdLine));
    CleanupStack::PopAndDestroy(2);

  4. #4
    Regular Contributor
    Join Date
    Mar 2003
    Location
    UK
    Posts
    159
    Cheers - that worked.

  5. #5
    Registered User
    Join Date
    Jun 2003
    Location
    Montreal
    Posts
    1
    Hi, there is a bug with this method, if the wap browser is already open, the browser will be restored with his current state since the OS will not restart the application.

    So the command line arguments are ignored and the url is never sent to the browser.

    Does anyone know how to solve that?

  6. #6
    Regular Contributor
    Join Date
    Apr 2003
    Posts
    52
    everything is explained in the document "utilizing external application views" from nokia

  7. #7
    Registered User
    Join Date
    Mar 2003
    Posts
    23
    I tried what was suggested by the "Utilizing External Application Views" for launching WAP but it doesn't seem to work. If it is not currently running, it will launch WAP but it will just freeze and you have to re-boot.

    If WAP is running, I get a "System Error" but it still launches the new URL.

    Any ideas or thoughts? Below is a snippet of code of how I am implementing it.

    if(iSettings->iAppModuleList[iSelectedIndex]->iDisplayName == _L("WAP"))
    {
    HBufC* param = HBufC::NewLC( 20 );
    param->Des().Copy(iSettings->iAppModuleList[iSelectedIndex]->iDocument);
    TUid id(TUid::Uid(AppUid));
    TApaTaskList taskList (CEikonEnv::Static()->WsSession());
    TApaTask task = taskList.FindApp(id);

    if(task.Exists())
    {
    HBufC8* param8 = HBufC8::NewLC(param->Length());
    param8->Des().Append(*param);
    task.SendMessage(TUid::Uid(0), *param8);
    CleanupStack::PopAndDestroy();
    }
    else
    {
    RApaLsSession appArcSession;
    User::LeaveIfError(appArcSession.Connect());
    TThreadId id;
    appArcSession.StartDocument(*param, TUid::Uid(AppUid), id);
    appArcSession.Close();
    }

    CleanupStack::PopAndDestroy();
    }

  8. #8
    Super Contributor
    Join Date
    Mar 2003
    Location
    Beijing
    Posts
    3,609
    Hi,

    Attached please find my sample code. It works beautifully. Should you have any problems, please let me know.

    Hope this solves your problem!

    Liuxg
    Forum Nokia
    Attached Files Attached Files

  9. #9
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    54

    Getting browser to work on emulator

    What does one need to do to get the programatic browser opening to work on the Series 60 emulator? Do I have to install or configure some WAP proxy thing?

    I already have the sockets example working using the virtual serial port, etc. I am running the emulator on Windows XP Pro.

  10. #10
    Registered User
    Join Date
    Jun 2003
    Posts
    7

    ...

    ...sure would be nice to be able to delete posts...
    Last edited by dpifko; 2003-09-08 at 20:20.

  11. #11
    Regular Contributor
    Join Date
    Aug 2003
    Posts
    99

    User completed?

    hi! i've used the function provided above to launch a WAP browser. It works fine, but how could i detect if the user has finished with it and returned back to the application?

    The code is as follows:

    TBuf<100> aAddr;
    aAddr = _L("4 http://wap.yahoo.com/");

    TUid id( KPhoneUidWmlBrowser );
    TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
    TApaTask task = taskList.FindApp( id );

    if ( task.Exists() )
    {
    HBufC8* param8 = HBufC8::NewLC( aAddr.Length() );
    param8->Des().Append( aAddr );
    task.SendMessage( TUid::Uid( 0 ), *param8 ); // UID is not used
    CleanupStack::PopAndDestroy( param8 );
    }
    else
    {
    if ( !iApaLsSession.Handle() )
    {
    User::LeaveIfError( iApaLsSession.Connect() );
    }
    TThreadId thread;
    User::LeaveIfError(iApaLsSession.StartDocument( aAddr, KPhoneUidWmlBrowser, thread ) );
    iApaLsSession.Close();

    DoSomething(); // !!! <------------------- i want this to execute only after the user has exited the browser and back to the application.
    }

    Currently, DoSomething() executes once the Services is launched. Then it'll show error.

  12. #12
    Registered User
    Join Date
    Aug 2003
    Location
    Oulu, Finland
    Posts
    1,122
    If the browser supported embedding, you could request for exit notification via NotifyExit(). As of Series 60 v1.x, the browser does not support embedding.

    Please tell what you would like to achieve with browser exit detection. For some (view-based) applications it might be feasible to use DoActivateL() to detect when the application view is reactivated after launching browser.

    Lauri

  13. #13
    Regular Contributor
    Join Date
    Aug 2003
    Posts
    99
    Thanks for the reply.

    I want to start a socket connection and send a file after the user exits from the browser. Now the socket part prompts for access point selection once services is started. Then it closes with error.

    How can i achieve this?

  14. #14
    Registered User
    Join Date
    Oct 2003
    Posts
    19

    Launch browser ??

    Hi All:

    Really thanks for all the useful tips here. May I know how to launch the browser to directly go to the specific wap site without go through the bookmark ?
    Thanks..!

  15. #15
    Registered User
    Join Date
    Sep 2003
    Posts
    4

    UID and NokiaOK

    Hi All,

    I have one question about NokiaOK.

    In the "launchwap.zip" sample code,
    it uses UID "0x10008D39" to launch the wap browser.

    Will we pass the NokiaOK if we do like this??
    (all phones use the same UID value??)

    If not, anybody has other good method??

    thanks!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×