Start a new topic

Download all files from a userId

 Hi,


I need a way to get all files uploaded by a user by just using the user id. So my questions are:


1. Is multiple files downloading feature currently available?

2. Is there a way to get all the file names using user id and then use files().download method?


Nikhil,

  1. What version of Android SDK are you using?
  2. Are all the files that are being uploaded by users marked as public, as by default the files are only visible to the creator?

Thanks,
Pranav
Kinvey Support

 

Pranav,

1. My app's minSdkVersion is 15 and targetSdkVersion is 24
2. The files are not marked as public and are to be downloaded by their specific creators only.

I will rephrase my query for better understanding,
I need code to download all the files uploaded by the creator himself. So like if "A" uploads 5 files named 1.jpg, 2.jpg, 3.mp4, 4.doc, 5.xls. How to download all these files without knowing their specific names. By using only creator's id.

 

Hi Nikhil,


The File/AsyncFile classes in Kinvey Android SDK do not provide a way to query Files store. They also do not provide a way of downloading multiple files.


An alternative to this is to get the list of files and then download them one by one. To get the list of files, you can query the same way you would query a collection (documented here: http://devcenter.kinvey.com/android/guides/datastore#querying) using collection name _blob. Your query can be something like 

 

Query q = mKinveyClient.query();
q.equals("_acl.creator","user _id");


You can use Business Logic custom endpoint to do this as well.


Once you have the file metadata, you can download them one by one using file _id as documented here: http://devcenter.kinvey.com/android/guides/files#Downloading


I hope this helps.



Regards,

Wani

Kinvey Support

Login or Signup to post a comment