×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    22

    How to Launch widget from an application.

    Hi,

    I want to start or launch a widget from an application.
    I see we can launch an application from another application using application id. Or even we can launch an application from the widget.

    Please help. Any help will be highly appreciated.

    Thanks,
    Anna

  2. #2
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,406

    Re: How to Launch widget from an application.

    Hi Anna,

    you can launch a widget in the very same way you launch a standard app. The only difference is that, in the case of a WRT widget, you have to obtain the widget's UID before you can actually launch it: to do this you can use the widget's id or name, and look for it within the list of installed apps.

    Hope it helps,
    Pit

  3. #3
    Registered User
    Join Date
    Feb 2010
    Posts
    22

    Re: How to Launch widget from an application.

    Hi Pit,

    Thanks for the info.

    But i use WRTIde provided by symbian for widget development. It doesnt show any widget id. Could brief it down how to get the widget's id.

    Regards,
    Anna

  4. #4
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,406

    Re: How to Launch widget from an application.

    Hi Anna,

    a question first: do you want to launch a widget from another widget, or from a Symbian C++ app?

    Pit

  5. #5
    Registered User
    Join Date
    Feb 2010
    Posts
    22

    Re: How to Launch widget from an application.

    Quote Originally Posted by jappit View Post
    Hi Anna,

    a question first: do you want to launch a widget from another widget, or from a Symbian C++ app?

    Pit
    Hi Pit,

    I want to launch a widget from a C++ app.

    Regards,
    Anna.

  6. #6
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,406

    Re: How to Launch widget from an application.

    Basically, you would have to:

    * retrieve the list of installed apps, by using RApaLsSession:
    http://library.forum.nokia.com/index...sionClass.html

    * search for your widget, by matching iFullName or iCaption with the name of your widget:
    http://library.forum.nokia.com/index...InfoClass.html
    (since iFullName should contain the whole path of the installed app, and widgets are installed in a subfolder named as the widget identifier, you could match these 2 values to exactly identify your widget)

    * use the retrieved UID to launch your widget

    Never tried it by myself, but it should work

    Hope it helps,
    Pit

  7. #7
    Registered User
    Join Date
    Feb 2010
    Posts
    22

    Re: How to Launch widget from an application.

    Hi Pit,

    Thank you very much.

    I havent tried it yet. I will update once i try it.
    But as i see the functions, i hope it will work.

    Thanks,
    Anna.

  8. #8
    Registered User
    Join Date
    Feb 2010
    Posts
    22

    Re: How to Launch widget from an application.

    Quote Originally Posted by jappit View Post
    Basically, you would have to:

    * retrieve the list of installed apps, by using RApaLsSession:
    http://library.forum.nokia.com/index...sionClass.html
    * search for your widget, by matching iFullName or iCaption with the name of your widget:
    http://library.forum.nokia.com/index...InfoClass.html
    (since iFullName should contain the whole path of the installed app, and widgets are installed in a subfolder named as the widget identifier, you could match these 2 values to exactly identify your widget)

    * use the retrieved UID to launch your widget

    Never tried it by myself, but it should work

    Hope it helps,
    Pit
    Hi,

    When we use the GetAllApps() function, it requires AllFiles CAPABILITY, which needs developer certificate.
    Is there any other api that i can use with self sign or Open sign online?

    Regards,
    Anna.

  9. #9
    Registered User
    Join Date
    Feb 2010
    Posts
    22

    Re: How to Launch widget from an application.

    Hi
    I used the following to get the installed apps
    I am able to install the application.
    But i am unable to open it. Basically somewhere the application is closed.

    Can anyone help me in this code bug.

    Code:
    _LIT(KFileName, "C:\\Data\\Files.txt");
    	const TInt KMaxSize = 512;
    	RFs fs;
    	RFile file;
    	RApaLsSession lsSession;
    	file.Replace( fs, KFileName, EFileWrite | EFileStreamText );
    	CleanupClosePushL( file );
    	
    	TApaAppInfo appInfo;
    	TBuf<KMaxSize>  buf;
    	TBuf8<KMaxSize> fileBuf;
    	TInt ret = 0;
    	// Connect to file server
    	
    	ret =  fs.Connect();
    	if(ret != KErrNone)
    	{
    		buf.Zero();
    		buf.Append( _L("Cannot Connect to fs : ") );
    		buf.AppendNum(ret);
    		fileBuf.Append( _L("\n") );
    		fileBuf.Append( _L("\n") );
    		fileBuf.Copy( buf );
    		file.Write(fileBuf  );
    		CleanupStack::PopAndDestroy( 1 ); // file, 
    		return;
    	}
    	CleanupClosePushL( fs );
    	
    	// Connect to application architecture server
    	ret = 0;
    	ret = lsSession.Connect();
    	if(ret != KErrNone)
    	{
    		buf.Zero();
    		buf.Append( _L("Cannot Connect to lsSession : ") );
    		buf.AppendNum(ret);
    		fileBuf.Append( _L("\n") );
    		fileBuf.Append( _L("\n") );
    		fileBuf.Copy( buf );
    		file.Write(fileBuf  );
    		CleanupStack::PopAndDestroy( 2 ); // file, fs
    		return;
    	}
    	CleanupClosePushL( lsSession );
    	
    	// Open (replace if exists) the file for writing
    	
    	
    	// Get info on all apps, then iterate through each app  
    	// and write its info (caption, name, uid) to file
    	ret = lsSession.GetAllApps();  
    	if(ret != KErrNone)
    	{
    		buf.Zero();
    		buf.Append( _L("Cannot GetAllApps : ") );
    		buf.AppendNum(ret);
    		fileBuf.Append( _L("\n") );
    		fileBuf.Append( _L("\n") );
    		fileBuf.Copy( buf );
    		file.Write(fileBuf  );
    		CleanupStack::PopAndDestroy( 3 ); // file, fs
    		return;
    	}
    	ret = 0;
    	do
    	{
    		ret = lsSession.GetNextApp( appInfo );
    		if(ret == KErrNone)
    		{
    			buf.Zero();
    			buf.AppendNum( (TUint)appInfo.iUid.iUid, EHex );
    			buf.Append( _L("\t") );
    			buf.Append( appInfo.iCaption );
    			buf.Append( _L("\t") );
    			buf.Append( appInfo.iFullName );
    			fileBuf.Copy( buf );
    			fileBuf.Append( _L("\n") );
    			file.Write( fileBuf );
    		}
    	}while(ret == KErrNone);
    	
    	buf.Zero();
    	buf.Append( _L("Files Written") );
    	fileBuf.Append( _L("\n") );
    	fileBuf.Append( _L("\n") );
    	fileBuf.Copy( buf );
    	file.Write(fileBuf  );
    	
    	CleanupStack::PopAndDestroy( 3 ); // file, lsSession, fs
    Regards,
    Anna

  10. #10
    Registered User
    Join Date
    Feb 2010
    Posts
    22

    Thumbs up Re: How to Launch widget from an application.

    Hi All

    I myself rectified the bug. Now i am able to launch the widget from the C++ application.

    Thank you all for the great help.

    I highly appreciate this discussion board.

    Thanks once again.

    This thread can be closed.

    Regards,
    Anna.

Similar Threads

  1. Widget launch
    By shankx in forum Symbian
    Replies: 6
    Last Post: 2010-11-20, 18:18
  2. launch a widget from the browser
    By moshiko in forum Symbian
    Replies: 3
    Last Post: 2010-04-22, 11:55
  3. [moved] Problem launch application from widget
    By johan@webinfostudio.se in forum Symbian
    Replies: 3
    Last Post: 2009-09-16, 16:03
  4. Launch widget from Java application
    By soumyso in forum Symbian
    Replies: 1
    Last Post: 2009-06-04, 09:32
  5. How to launch a Widget in an applicaion
    By eling0167 in forum Symbian
    Replies: 11
    Last Post: 2008-11-18, 08:15

Posting Permissions

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