Download file from Webservice using React Native - react-native

I have written a webservice which is sending me excel file from server to download, I have a mobile Application written in React-Native and I want to download that file in my mobile application,
I tested my webservice in browser I am able to download the file, but how to do that in react-native.
My RestAPI accept some parameter in request and in return it will download the file.
I have tried rn-fetch-blob and react-native-fs but they gives are using direct path to download the image in my case my api is providing me the file.
I have search a lot but couldn't find anything related.
Can anyone help me how to implement in this in react-native.

Related

I need to implement the inApp video download feature same as Netflix,Hotstar,Amazone Prime in React native App?

A couple of months back, I came across a client requirement who wanted to build a feature to download and restrict video files in Android App, just like YouTube, Netflix, Amazon Prime does with us.
The steps need to be implemented is as follows :
Download the video from the URL
Encrypt the video file
Decrypt the video file at the time of playing
I use RNFetchBlob for download the video from the urls and RNFS is used for file access.
Requirement :
I need to encrypt the video file and decrypt the video file from the App.
If anyone knows the solution please help me......
I need to encrypt the video file and decrypt the video file from the App.

Using Google gapi browser library on react native

My app successfully logs users into Google using react-native-google-signin. I want to call other google APIs like the Google Calendar API using a token.
Which of the 3 options (or something else entirely) should I use?
Download the javascript file from google-api-javascript-client and put it in my project. The tutorials for that are for html pages rather than react native. They suggest using script tags in the HTML.
Use the google-api-nodejs-client which adds 4mB
Make requests manually using axios/ fetch (this is what I did in the end)

How to handle pdf files from server response?

I am working on React-Native mobile app and I need to handle pdf file coming from the server. The idea is when the user clicks on button, a request to the server is made and a pdf file is returned. My question is how to download and parse this file and show it to the user?
You can do it in app BUT you are going to have a lot of pain, especially with android devices.
My advice is using the Linking api and open a webbrowser:
https://facebook.github.io/react-native/docs/linking
The idea is to check if your url contains a .pdf. You can use a mix of:
https://lodash.com/docs/#includes
https://lodash.com/docs/#filter
https://lodash.com/docs/#split
When you are sure that your url is a pdf, you can use:
Linking.openURL(url);

DropBox core API how to get GPS metadata for each image?

I am using Core Api from drop box to upload and download file. The upload and download take place from my device. So the image is stored locally and then uploaded. And when downloaded they store on device and I pull them from their locations.
I am able to access the metaData dropBox provides via the restClient LoadedMetaData method. However that method doesn't provide support for the GPS. In this blog Post from dropBox https://www.dropbox.com/developers/blog/86/new-additional-information-about-photo-and-video-files
it has an update to access this. But it is done using a GET HTTP request. Can I do this from inside xcode? I tried accessing the request directly and it gives an error of "NO AUTH" so I cant grab the JSON file. But we should already be authorized from signing in directly with the api.
Any help would be so appreciated.
I believe that in the Core SDK, you can just call [client loadMetadata:path withParams:#{#"include_media_info": #"true"}];
(Caveat: I haven't tested it myself. Please let me know if it works.)

Is there a way to create a Dropbox link that opens a file or a folder in the native app?

Basically, what I would like to do is to create a link from a web application that will open a Dropbox file from appropriate Dropbox native app. Google Drive for example allows you to re-format the unique URL for a file such as https://docs.google.com/blablabla which you can retrieve from their API, into googledrive://docs.google.com/blablabla and lets you open the file in Google Drive native app.
I have tried dropbox:// URLs with no success, and have not found any existing conversation on this despite running cross multiple conversations on the same subject for Google Drive or Evernote. Please let me know if it is possible to somehow generate this via API or based on the folder structure etc.
Thanks!