I use the browser to open a pdf file, but I want to use the regular file manager in order to open the file with a third party application. How do I do that?
BrowserSession page = Browser.getDefaultSession();
page.displayPage("file:///SDCard/BlackBerry"+Integer.parseInt(tab[4])+".pdf");
It depends on OS version. In OS 5 RIM added the net.rim.device.api.ui.picker.FilePicker class that does what you need. For pre 5 OS you have to implement your own screen to select a file from the file-system. Your local BB SDK should contain a sample app for this, search by "fileexplorerdemo" to find that sample and to see the code.
Related
I am developping a mobile application using Cordova. This application allows users to navigate in a kind of a file manager and allows them to download files. I use the plugin "FileTransfer" to download the file on the user's device and then call the InAppBrowser (version 0.5.2) plugin in order to open it.
While it works really great under Android, I can't say the same under iOS (tested under versions 7 and 8).
This is the line of code I use to open the downloaded file:
window.open(entry.toURL(), "_system");
Under Android, it proposes the user which application he wants to launch to open the file or launches automatically the default application based on the file extension. Under iOS, the file is downloaded and then nothing happens. I have found out I could use the integrated viewer of the InAppBrowser plugin when the user is under iOS. I do that in this way:
if (navigator.userAgent.match(/iPhone|iPod|iPad/))
window.open(entry.toURL(), "_blank");
else
window.open(entry.toURL(), "_system");
With these lines of codes, if the user is under iOS, the integrated viewer is launched and displays the file. The problem is for ZIP files or other files that can't be rendered in the viewer. This one says "Load Error".
I think that if "_system" worked, Safari would be launched and would propose the user how he wants to open the file.
Does anybody have an idea of how I can make "_system" worked in iOS? Is this eventually a known problem (I couldn't find anything related to my problem)?
If this can be relevant to my problem, I use Phonegap Build in order to generate the .ipa file.
On iOS when you use _system, it try to open the url you pass with safari.
As iOS have sandbox access limitations, safari can't open the url because it's inside your app sandbox.
You can try this plugin, it provides an "open with" dialog that will show you the apps that support the type of file you want to open if any available.
https://build.phonegap.com/plugins/1076
I have an app that downloads files that need to be edited and submitted back to the server through the app. These files could be anything, but are most likely to be .docs. I want to be able to open and edit these files in another app on the device, such as a .doc editor.
I've been able to get this functionality to work in similar Android and Chrome apps, but I'm very new to iOS so I'm not sure what my options are.
Is there a way to give permission for another app to edit a file that is in my app's sandbox? If not, is there a way to get the file back for submittal (like finding it through a file explorer launched through my app - similar to an 'Open..." file explorer dialog used in Windows/Mac OS/Chrome)? Am I going to have to create a way for the editor app to share the edited file back to my app?
Thanks in advance for your help!
To manage the file and the paths take a look at the documentation for NSFileManager:
https://developer.apple.com/LIBRARY/mac/documentation/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/Reference/Reference.html
I usually write using NSFileHandle for reading and writing:
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSFileHandle_Class/Reference/Reference.html
Hope this helps.
iOS8 will provide methods to allow apps to co-operate with "extensions".
See "Creating Extensions for iOS and OS X, Part 1 & 2` in the WWDC14 videos.
Also see the Apple "App Extension Programming Guide".
I ended up sending the file to a 3rd party app for editing and then sending the file back from the 3rd app to my app.
I am working on an Blackberry application in which I have to show some PDF files in my application.
I know we can show the PDF file as a GOOGLE document, I have already done that. But this time my task is to show PDF files inside application.
Do we have any option to show PDF files in our own application by using some SDK's ?
Please suggest me.
I dont think any blackberry sdk support this facility.
There is only one option to view pdf files offline is to download and view using a third party pdf viewer.
Even blackberry dont have given a built in pdf reader to user,when I was looking for the same issue I found that only one company SLG Mobile has made this app(beamreader) and blackberry gave them very special award(dont remember award name now),
so this third party app is free for one month and after that you have to pay nearly 500 Rs as licence fee.
Now for BB10 Adob has created a reader and it comes with device itself.
I'm making a video decoder application on Xcode 4.2. When I click on a button I need the file explorer to open so that I can choose the appropriate file to decode.
How do I give this file explorer option in my app?
There no such thing like file explorer in iOS .So you cant browse through the files in the iOS .At the most you can access the camera roll . Apple doesnt allow to access the other things like songs,other file etc
I want to write a program that launches the blackberry's home screen and then browse the file i required and when i click on import option i want to retrieve the path of that selected file. Is it possible in blackberry? if yes please guide me
Try FilePicker (ignoring the "launches the blackberry's home screen" part of your question which isn't very clear).
If FilePicker is not working for you, find a way to open the built-in Media app which has an Explore menu to browse the filesystem (on OS 7 at least) -- kind of what you'd do with "intents" on android the bb equivalent of which would be CHAPI.