07-06-2012 09:24 AM
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.
07-08-2012 11:03 AM
I believe that's because the native media viewer already has a handler setup for those types. Not sure tho ![]()
08-13-2012 02:32 PM
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.
08-14-2012 01:36 AM
i am actually using the FilePicker API as temporary solution (with the limitation of OS6+)
... 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 ![]()
08-14-2012 01:47 AM
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.
08-14-2012 01:58 AM
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.
08-14-2012 02:03 AM
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.
08-14-2012 02:03 AM
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..
08-14-2012 02:07 AM
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/li
08-14-2012 10:11 AM
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.