Execute with associated application

Login to reply to this topic.
Mon, 2005-03-21 13:08
Joined: 2005-03-21
Forum posts: 45
Hi,

How do i execute a file with its associated application. For example if i select an mp3 file it should play with its associated application.


Thanks in advance.

Regards,
Prabhu.

Mon, 2005-03-21 13:55
Joined: 2004-05-20
Forum posts: 83
Execute with associated application
Write a recognizer?

c0deab1e

Mon, 2005-03-21 14:01
Joined: 2005-03-21
Forum posts: 45
Execute with associated application
Quote from: c0deab1e
Write a recognizer?

Can u please give me some examples or more details how i have to write a recognizer.
Mon, 2005-03-21 15:14
Joined: 2004-07-28
Forum posts: 1379
Execute with associated application
You don't need to write a recogoniser.  A recogoniser is used to associate a file type with a specic app, in the same way the extension is used in windows to do it.  You would need to write one if say your app played MP3s, and you wanted the lauching of an MP3 to start your app.

You question sounds to me more like you want to do the lauching.  So you want to open an MP3, and have it open in what ever app is associated (via a recog.) with it.  Is that correct?

If so, take a look at RApaLsSession::StartDocument in the SDK.

didster

Mon, 2005-03-21 16:07
Forum Nokia Champion
Joined: 2003-10-01
Forum posts: 723
Execute with associated application
You can use Document Handler (documenthandler.h) on Series 60.

Gabor Torok
Software architect, Agil Eight (http://www.agileight.com/)
Blog: http://mobile-thoughts.blogspot.com/

Tue, 2005-03-22 06:58
Joined: 2005-03-21
Forum posts: 45
Execute with associated application
Hi,

Thanks a lot Cheezy

How do i get the icon of the associated application?

Regards,
Prabhu
Tue, 2005-03-22 09:29
Joined: 2004-07-28
Forum posts: 1379
Execute with associated application
Call AppForDocument which will give you the UID of the app associated with the file.  Then call GetAppIcon passing in the UID.

didster

Tue, 2005-03-22 12:24
Joined: 2004-12-23
Forum posts: 239
Execute with associated application
Hi

I have also applied documenthandler.h
but i m getting error cause tool abort..(so many linking error associated with function where i have used documenthandler for launching sound files(playing)...
Now how coudl i furnish it.........
Any help?Huh?&&&& Any light on this problem..
Thanks

---------------
Bhatt Kavita

Thu, 2005-03-24 10:31
Forum Nokia Champion
Joined: 2003-10-01
Forum posts: 723
Execute with associated application
What kind of errors do you have? Put some piece of code here.

tOtE

Gabor Torok
Software architect, Agil Eight (http://www.agileight.com/)
Blog: http://mobile-thoughts.blogspot.com/

Tue, 2005-03-29 09:33
Joined: 2005-03-21
Forum posts: 45
Execute with associated application
Quote from: didster
Call AppForDocument which will give you the UID of the app associated with the file.  Then call GetAppIcon passing in the UID.

Hi,

I have problem in getting the ICON.

CApaMaskedBitmap* aAppBitmap;
ret = RPASession->GetAppIcon(uid, TSize(13,13), *aAppBitmap);

Is something wrong in the above code.
Wed, 2005-03-30 08:35
Joined: 2004-07-28
Forum posts: 1379
Execute with associated application
Call GetAppIconSizes first to actually get the correct sizes of the icons in the app, then call GetAppIcon passing in one of the returned sizes.

didster

Wed, 2005-03-30 08:54
Joined: 2005-03-21
Forum posts: 45
Execute with associated application
Hi,

Thanks for ur reply.

The way the CApaMaskedBitmap is passed is correct?

or i have to create an object using NewLC and then pass the object to the function.


Regards,
Prabhu.
Wed, 2005-03-30 09:28
Joined: 2004-07-28
Forum posts: 1379
Execute with associated application
You will have to NewL one before you use it - you can't just deference a NULL/invalid pointer and pass that.  The usual key is if a function takes a "CClass&" then you construct it, if it takes a "CClass*&" then it will construct it for you.

didster

Wed, 2005-03-30 10:15
Joined: 2005-03-21
Forum posts: 45
Execute with associated application
Hi,
Code:
if((ret == KErrNone) && (uid.iUid!= 0))
{
CApaMaskedBitmap aAppBitmap = CApaMaskedBitmap::NewLC();
CArrayFixFlat<TSize> *aArrayToFill = new CArrayFixFlat<TSize>(3);
RPASession->GetAppIconSizes(uid, *aArrayToFill);
RDebug::Print(_L("%d"), aArrayToFill->Count());
ret = RPASession->GetAppIcon(uid, (*aArrayToFill)[0], *aAppBitmap);
}

THis is the code iam using but the app crashes.

Please help me.
Wed, 2005-03-30 10:21
Joined: 2004-07-28
Forum posts: 1379
Execute with associated application
Crashes on which line?  Whats RPASession and why is it allocated on the heap?

I'd do it like this:

Code:

RApaLsSession aLs;
User::LeaveIfError(aLs.Connect());
CleanupClosePushL(aLs);

CArrayFixFlat<TSize>* array=new(ELeave) CArrayFixFlat<TSize>(3);
CleanupStack::PushL(array);
User::LeaveIfError(aLs.GetAppIconSizes(uid,*array));
for(TInt i=0;i<array->Count();i++)
{
CApaMaskedBitmap* iconBySize=CApaMaskedBitmap::NewLC();
if(aLs.GetAppIcon(KUidTestApp,(*array)[i],*iconBySize) == KErrNone)
{
// icon is now iconBySize
}
CleanupStack::PopAndDestroy(iconBySize);
}

CleanupStack::PopAndDestroy(array);
CleanupStack::PopAndDestroy(&aLs);


didster

Wed, 2005-03-30 10:30
Joined: 2005-03-21
Forum posts: 45
Execute with associated application
Hi,

Thanks a lot Cheezy

Its working now.
  • Login to reply to this topic.