Start a new topic

File related issues with Kinvey

This is my upload file code:

kinveyClient.file().upload(file, new UploaderProgressListener() {

            public void onSuccess(Void result) {

                Log.i("TAG", "successfully upload file");

                textview.setText("SUCCESS");

                Toast.makeText(MainActivity.this, "SAVED Sucessfully",

                        Toast.LENGTH_LONG).show();

            }

            public void onFailure(Throwable error) {

                Log.e("TAG", "failed to upload file.", error);

                textview.setText("fail");

            }

            public void progressChanged(MediaHttpUploader uploader) throws IOException {

                Log.i("TAG", "upload progress: " + uploader.getUploadState());

                // all updates to UI widgets need to be done on the UI thread

            }

        });



this is the download code:

File file=new File(nam);

     FileMetaData myMetaData = new FileMetaData("518fb003a6b1878c340040c8");

        FileOutputStream fos=null;

  try {

   fos = new FileOutputStream(file);

  } catch (FileNotFoundException e) {

   // TODO Auto-generated catch block

   e.printStackTrace();

  }

        kinveyClient.file().download(myMetaData, fos, new DownloaderProgressListener() {

            public void onSuccess(Void result) {

                Log.i("TAG", "successfully downloaded file");

            }

            public void onFailure(Throwable error) {

                Log.e("TAG", "failed to downloaded file.", error);

            }

            public void progressChanged(MediaHttpDownloader downloader) throws IOException {

                Log.i("TAG", "progress updated: "+downloader.getDownloadState());

                // any updates to UI widgets must be done on the UI thread

            }

        });


The download isn't working!

Kindly help me out as soon as possible!

Login or Signup to post a comment