Need clarification in Dropbox sample application - objective-c

I need to integrate DropBox in my application. I tried dropbox sample application downloaded from www.dropbox.com. While working with that app after Login to dropbox, it goes to Random photo controller and there when we press the Random Photo Button, it is showing the Alert that "Put .jpg photos in your Photos folder to use DBRoulette!. But in dropbox website, there are three .jpg images.

Check your dropbox folders ... you will have a new one called Apps. One of the subfolders will be your apps root folder. Place a photo there with jpg or jpeg extension and it should work.

Related

Downloading private videos inapp react native

I am trying to implement something in react native:
I have a url of video which i'm showing in react native video component, how can i give a button to download that same video in mobile but it should not appear in gallery.
Also if the video is private where the headers can be passed and how?
How to download any file ?
Well for downloading any file like video,img you first need permission to read and write into internal/external storage of phone and after that you need a native module that can download files from server to the local folders of phone.
there are two best known libraries for downloading files
https://www.npmjs.com/package/react-native-fs
https://www.npmjs.com/package/react-native-fetch-blob
Now you can follow their documentation to download files like Videos,images or whatever you want to your user's phone.
Now Lets come to the part that you dont want it to be available to user via gallery.
For this i suggest using react-native-fetchblob as it has builtin intent actions and views.
You can download a video file with any random name like 1234CACHE any random name without any extension to it, specially dont give it extension like video.mp4 because gallery detects .mp4 files so dont give it any extension and the file won't be available in any gallery.
Now how to hide the file?
react-native-fetch-blob allow us to save files into directories that are not publicly available i mean user cannot reach those directory and these directories are used only for saving App's data so you can save your video file in one of these directories.
Now after completing your download, You can open your file with the Intent.
For Example:-
const VIDEO_PATH = res.path() //the path where your downloaded video is saved, you will actually receive this in the response of download function.
const MIME_TYPE = "video/mp4"
//Now finally call the intent with video mime so the video will be opened in user's media player, or if you want your own media player you can use any library for that.
android.actionViewIntent(VIDEO_PATH , MIME_TYPE)
Note: You can only download a video if you have a path URL to the video file, You must not mix web URL with Video File URL, Video file url has file name and video extension at the end of the url. such as https://someURL.com/video.mp4 this is video file url, but if you have something like https://SomeURL.com/video it is not a video file instead it is a webpage displaying that video file so you cant really download that specific video from a webpage!.
There can be multiple approaches to this.
I hope you have an idea about your video player, download option depends on your server and site.
You can change the file extension of downloaded video, like my_video.notMP4. So the video will not show in the Gallery as it not detected as a video file now.
Hide the folder where the video file is downloaded, adding a dot(.) before the folder name can hide the folder in Android/Unix and video will be hidden from Gallery. Example .my_Video_folder
For more safety, you can encrypt the video and make them in custom chunk which only your player can play. But you may need to make or find such a video player.
I could not understand the headers part, please explain.

How we can upload camera roll image automatically to server

How I can upload a camera roll image automatically to server? This same thing implemented in Dropbox and Google Photos and some other apps also. What should I do to achieve such kind of functionality in my app?
What you are asking is not a single question, but a paradigm. An entire process, that includes:
Obtaining authorisation to access the photo library.
Accessing assets (images/videos) in the user's gallery.
Uploading to a server.
Read up on all the three, if you want to achieve this. In a nutshell it is as follows:
You use ALAssetsLibrary to access assets (the photos and videos in the user's gallery). If the user has not authorized yet, the user will be asked automatically. If the user has authorised access, you can request for assets. If the user has denied access explicitly, you should not attempt to access assets.
See THIS answer to see how you can access images using the ALAssetsLibrary.
In the success block, you can access the images with :
UIImage* image = [UIImage imageWithCGImage:asset.defaultRepresentation.fullResolutionImage];
Once you have the image, you can upload it using any technique (NSURLSession, AFNetworking, etc)
dropbox not upload the camera roll images automatically to server or there is no application in iOS which automatically upload images until user give it access permission.
Dropbox not working until user enable photo access permission.
if you want to upload the images first take all images access using ALAssetsLibrary than send the images to server in background using GCD or NSOperationQueue
are you trying to make it so that when you take a picture with the iOS camera it auto uploads to your server?
I don't believe you can do that, my understanding with dropbox and google on your iOS device is that their app has to be open to upload pictures. From there it's no big deal to access a user's photos and allow them to upload one or many pictures.
Dropbox and google also have desktop apps that run on OS X that will auto upload images after the device is plugged into the computer, but I am assuming that isn't what you are asking.

Using dropbox Chooser drop-in to retrieve a non-expiring link to files

I would like to use the Chooser drop-in to select a file from dropbox and then synchronize my app with that file occasionally in the background.
https://www.dropbox.com/developers/dropins/chooser/js
A scenario would be:
List item
User selects file.
File uploads to my app.
User returns to my app a few days later after modifying the file in dropbox.
My app should synchronize and pull down that particular file (without again displaying the Chooser drop-in).
The problem is that the Chooser provides an expiring link to the file:
"direct" is an expiring link to download the contents of the file
I can use the Core API exclusively which would work, however I would have to build my own UI to browse the user's dropbox directory. Ideally, I'd prefer to not introduce the world to another file browser; Dropbox has a file browser - and people are familiar with it. Is this possible?
Thanks,
You can just get a preview link and convert it. See https://www.dropbox.com/developers/blog/53/programmatically-download-content-from-share-links.

Can I give my Google Drive files edit permission in my iOS app but make those files invisible or view only in a browser

After my iPhone app user Signs In using the standard Google Drive sign in GTMOAuth2ViewController, I want my app to be able to view and edit the Google Drive files. But I don't want users to be able to edit, replace, or remove those same files using a browser. Is it possible to set up permissions to make this work?
Check out the application data folder: https://developers.google.com/drive/appdata?hl=en This might do what you want.

How to upload file from my iphone application to user own dropbox?

I had created an iphone application witch can generate a pdf file when the user use the application.
how can the user have the option to sent the pdf file to his own dropbox?
I had tryed with dropbox examples: where i can make an api and upload to my own dropbox.
But it's not what i want.
I want my application to do so: when the user generates a pdf file, so the login box of dropbox apear so he can log in and upload the file automaticaly to his own dropbox.
I have google it, but i did't get any examples including this solution.
Please help me if you can.
Have you looked at this blog post that i think describes what you are looking for.
http://www.drdobbs.com/tools/working-with-dropbox/232600482?pgno=1