How do store pdf to sdcard on Android in Rhomobile - rhomobile

I have to store a pdf that i'm generating through my application. I don't know the path for the sdcard for storing the file.
I guess the path needs to go into here
pdf.save_as(file_location)
Can anyone suggest the path ?

You can use /sdcard/ to store files on to the sdcard for Android
file_location = File.join('/sdcard/','My.pdf')
pdf.save_as(file_location)

Related

React Native Expo - Does document directory path get modified on App update?

In my application i save a batch of images locally using the Expo FileSystem and storing their fully uri in redux (file://......). I transform the image to base64 and store this in the document directory, as a file, whenever an image is taken. When the user uploads the batch of images to firebase I utilze the uploadBytes function, thus converting the base64 file to bytes. However, when I update the app through Testflight or App Store I am not able to view or upload images that already have been taken. Is this because the Document directory path is modified upon update?
Docs for filesystem: https://docs.expo.dev/versions/latest/sdk/filesystem/
Fixed: Seems like updating the app does change the file path. Therefore, it was solved by first fetching the relative document path and appending the desired file e.g FileSystem.documentDirectory + ${nameOfFile}

ability to pick file in iphone and upload it to server

I know that there is NSFileManager class to manipulate with files in local application folder using:
NSTemporaryDirectory()
But what if I want to pick a file from iPhone storage, I didn't even find a default iOS application like 'fileManager' or 'fileExplorer' in Android to browse my files. Can someone explain me how it works in iOS. Or there is only an ability to manipulate files in my application temporary folder?

iOS where should I download and store index.html

I want to download a Javascript/Html5 code in zip format and then unzip the code and load the index.html file in webview in iOS.
So where should I save this zip folder on iPhone ? Document Directory or cached Directory ?
All data that can be downloaded again most correct be stored in cached Directory. Files stored in Document folder will be synchronized with iCloud. See link. In your case, I think you need to store in cached.
Hope it helps you.
Better store it in document directory since your file should be available always.In Cache directory,you should store only those files which can be recreated easily. System may delete content of this directory (to free up the disk space) when it is required.

View image file written to filesystem using FileWriter in gallery in IOS using phonegap

I am writing a image file to the IOS Filesystem using phonegap File API (FileWriter). I am able to write the file successfully however it does not show up in the gallery. Is there a specific location on the fileSystem i should be writing this file in order for it to be visible in the gallery ? . Or is there any other way to achieve this (i will have to write the file using file writer as i am getting a response from a service in binary/base64 )
FileWriter writes to the phone memory inside the app sandbox.
If you want to save it in the gallery you can use this plugin

How to refer file located in current application into file in SD card

I have a one script file in my current application.. The path for same look like this.
D:\myproj\Example\www\abc.js
while running my application in device it will download one file into my SDcard dynamically.
I need to parse my downloaded application and need to set this "abc.js" file path in this.
I can able to set path if my file is in SDCard , but dont know how to refer path which is in my current application..
If you have that file on SDCard, then the full path to it will be as follows:
file:///SDCard/myproj/Example/www/abc.js
ADDITIONAL INFO:
If your file is located in cod file, then there is a way, but it is not documented and it is not guaranteed that it will work on all devices and RIM OS versions.
Code below shows document.htm encapsulated in modulename.cod in BlackBerry browser.
BrowserSession session = Browser.getDefaultSession();
session.displayPage("cod://modulename/document.htm" );
Try to use cod://modulename/abc.js to specify path to your js file.
To reference an application embedded file (in this case an image file stored in images directory):
"file:///local/images/embedded_img.png"

Resources