Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Archived:Launching the Nseries Music Player in a certain view using Symbian C++

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Article Metadata
Tested with
Devices(s): S60 Nseries devices
Compatibility
Platform(s): S60 3rd Edition, Feature Pack 1, S60 3rd Edition, Feature Pack 2
S60 3rd Edition FP2
S60 3rd Edition FP1
Article
Created: User:Technical writer 1 (02 Apr 2008)
Last edited: hamishwillee (15 Jun 2012)

Overview

The Music Player application used in new Nseries devices uses a view system different from the standard S60 Music Player. This may cause problems in 3rd party applications that try to launch the Music Player in a certain view (e.g. Now Playing).

Description

Different views of the Music Player (MPX) in new Nseries devices cannot be activated using the standard methods of the AVKON view architecture. While there is no public API to control MPX views, view switching is still possible by sending messages to the Music Player application with TApaTask::SendMessage() or via command line arguments if the player is currently not running.

Solution

How to find out which Music Player is used in a device?

The UID of the Music Player application is changed in the new version.

 const TUid KAppUidMPX                 = { 0x102072C3 };

RApaLsSession::GetAppInfo() can be used for checking whether an application with this UID exists.

 TInt ret = apaSession.GetAppInfo(appInfo, KAppUidMPX);

GetAppInfo() returns KErrNone if the device has a new version of the Music Player and KErrNotFound if the device has an old version of the Music Player.


Launching the Music Player in a certain view

 const TUid KMPXPlaybackViewTypeUid    = { 0x101FFCA0 }; // Now Playing View
 const TUid KMPXCollectionViewTypeUid  = { 0x101FFCA1 }; // Collection View
 void LaunchMPXViewL( const TUid& aViewUid )
   {
   // Construct MPX parameter string
   TBuf8<16> param;
   param.FillZ(16);
   param[8] = 0x01;
   param[12] = (TUint8) (aViewUid.iUid & 0x000000ff);
   param[13] = (TUint8)((aViewUid.iUid & 0x0000ff00) >> 8);
   param[14] = (TUint8)((aViewUid.iUid & 0x00ff0000) >> 16);
   param[15] = (TUint8)((aViewUid.iUid & 0xff000000) >> 24);
 
   TApaTaskList taskList( CEikonEnv::Static()->WsSession() );
   TApaTask task = taskList.FindApp( KAppUidMPX );
 
   if ( task.Exists() )	  
     {
     task.SendMessage( KAppUidMPX, param );
     return;
     }
 
    RApaLsSession apaSession;
    TApaAppInfo appInfo;
    User::LeaveIfError( apaSession.Connect() ); 
    CleanupClosePushL( apaSession );
 	
    User::LeaveIfError( apaSession.GetAppInfo( appInfo, KAppUidMPX ) );
 	
    CApaCommandLine *cmdLine = CApaCommandLine::NewLC();
    cmdLine->SetExecutableNameL( appInfo.iFullName );
    cmdLine->SetCommandL( EApaCommandRun );
 
    // Collection view is the default view at startup
    if( aViewUid != KMPXCollectionViewTypeUid )
      {
      cmdLine->SetTailEndL( param );
      }
 
  User::LeaveIfError( apaSession.StartApp( *cmdLine ) );
 
  CleanupStack::PopAndDestroy( 2 ); // cmdLine, apaSession	  
  }
This page was last modified on 15 June 2012, at 00:00.
63 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×