Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Contributor
Posts: 6
Registered: ‎07-06-2012
My Device: Blackberry 9800
My Carrier: mtc touch

Native Media application

Hi,

 

I working on a project that requires the following:

 

-invoke the native application for Media content, so the user can view different types of media (pictures, videos) in the device, and when the user selects an image/video/audio, the selected one will be loaded into the application to be processed depending on the application needs.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

this process is implemented on several very known apps like foursquare, whatsapp….

 

What i came up with so far  is just to invoke the native media content application without the ability to interact with it (if the user has selected an image or not):

 

// Create an invocation instance with the specified URL

// where the file type is one of the media types supported

// by the media player.

Invocation invocation = new Invocation(null, null, BlackBerryContentHandler.ID_MEDIA_CONTENT_HANDLER, false, ContentHandler.ACTION_OPEN);

invocation.setArgs(new String[]

{ BlackBerryContentHandler.MEDIA_ARGUMENT_VIEW_PICTURES });

// Get the Registry object using the class name of the

// application

Registry _registry = Registry.getRegistry(Application.getApplication().getClass().getName());

// Invoke the content handler.

_registry.invoke(invocation);

 

 

Note: The media application opens successfully, but i can't find a way to intercept any userr interaction (if the user has selected an image or not)...

 

Also when pressing and holding the menu key, I noticed that it is running in a separate application from my app (which is not the case in whatsapp, foursquare and all other apps where this process is implemented)

 

Any help is so much appreciated.

 

Thank you.

Developer
Posts: 246
Registered: ‎12-13-2010
My Device: Not Specified

Re: Native Media application

I believe that's because the native media viewer already has a handler setup for those types. Not sure tho Smiley Happy

Developer
Posts: 292
Registered: ‎07-25-2008
My Device: Passport

Re: Native Media application

I think you want to look into the FilePicker API.  On OS6+, it has various configurable modes that make it look like what you want.

New Contributor
Posts: 6
Registered: ‎07-06-2012
My Device: Blackberry 9800
My Carrier: mtc touch

Re: Native Media application

i am actually using the FilePicker API as temporary solution (with the limitation of OS6+) Smiley Sad ... and still wondering why i keep seeing what i exactly want in nearly all the well known apps but not a single documentation on how we can do it  Smiley Sad

Developer
Posts: 467
Registered: ‎07-16-2009
My Device: Z10 LE
My Carrier: Vodafone NL

Re: Native Media application

1. You could inject global menu item to the veiwer application - "Select to my app"

2. You could show message for user before openenig file browser "Please use "Select..." menu item"

3. You could probably determine what is currently selected when user selects menu item

 

I never did it before. But check in debug, probably you could use this scenario. At least I saw one app that is doing this.

 

About Foursquare - they only allow you to add pictures. So I think the use FilePicker APi. 

Developer
Posts: 292
Registered: ‎07-25-2008
My Device: Passport

Re: Native Media application

The example code you provided at the start of this thread most definitely is not using the FilePicker API, so I'm wondering what you're doing, what you're actually seeing, and what you want to see.

 

To make the FilePicker resemble the system media apps, you have to configure it correctly by calling its setView() method before showing it.

 

To inject menu items into the system apps directly, external to your application, you need to use ApplicationMenuItemRepository.  However, that's a totally unrelated thing to implement.

Developer
Posts: 467
Registered: ‎07-16-2009
My Device: Z10 LE
My Carrier: Vodafone NL

Re: Native Media application

Please ignore my previos answer.

I've just refreshed FilePicker API in my memory and found that it allows you to see all file types.

 

So could you point what limitation yu faced with FilePicker. And why it's not enough for you.

New Contributor
Posts: 6
Registered: ‎07-06-2012
My Device: Blackberry 9800
My Carrier: mtc touch

Re: Native Media application

hi Eugen,

 

i could definitly use the scenario you proposed but i won t get the same user experience at all... some users will not notice where they should click easily...

 

About Foursquare (and many other apps e.g. whatsapp, WLM, Google talk, Facebook and many more..) - It is definitly not FilePicker API since they are using it in OS 5.0 and even lower... As we all know by now FilePicker won't show on OS 5.0 (only works on simulator) even if the API is available..

Developer
Posts: 467
Registered: ‎07-16-2009
My Device: Z10 LE
My Carrier: Vodafone NL

Re: Native Media application

Ok.

 

You always mentioned os 6. so I was thinking this is yours target. It's true that FilePicker throws exception on 5 OS.

 

What all other apps are doing, same as ours, we use FilePicker for OS 6+ and own solution adopted from here - http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800256/... - for 5 OS.

Highlighted
Developer
Posts: 292
Registered: ‎07-25-2008
My Device: Passport

Re: Native Media application

Actually, FilePicker does work on OS5, even on real devices.  It just doesn't work on the early builds of OS5.  Anything newer than perhaps a month or so after OS5 was on the market, should work just fine.  Of course in the real world, enough users never bother to upgrade their device OSes (a problem I'm hoping BB10 will address).  Also, on OS5, the FilePicker is a bit more generic and primative looking, and doesn't have media type-specific modes.

 

As far as those apps you mentioned, they're not doing something magic and inaccessible.  On OS5, they're simply implmenting their own file picker screens from scratch, instead of using a system-provided one.  So its more work, basically.