Start a new topic
Answered

Uploading of an image from an andorid app raising an exception of "user currently not logged in"

I'm making an android app that clicks an image and uploads the image, which has been saved in the phone storage to the cloud using kinvey at backend. But every time i run the code provided on the kinvey website which goes as - 


  

import com.kinvey.java.core.UploaderProgressListener;
...
java.io.File file = new java.io.File(getFilesDir(), "chicken_fried_waffles.txt");
file.createNewFile();
mKinveyClient.file().upload(file, new UploaderProgressListener() {
    @Override
    public void onSuccess(Void result) {
        Log.i(TAG, "successfully upload file");
    }
    @Override
    public void onFailure(Throwable error) {
        Log.e(TAG, "failed to upload file.", error);
    }
    @Override
    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
    }
});

  Then it throws me an exception -


E/Activity file: failed to upload file.

                 com.kinvey.java.KinveyException:

                 REASON: No user is currently logged in.

                 

I don't what I'm doing wrong here. The ping functionality for the same is working fine. Please help 






Best Answer

Sharmistha,

Every app action needs an active user context. So you will need to login in the app and then upload the file.

Please take a look at the following:

http://devcenter.kinvey.com/android/guides/users#ActiveUser

http://devcenter.kinvey.com/android/guides/files#Uploading

Thanks,

Pranav

Kinvey Support

1 Comment

Answer

Sharmistha,

Every app action needs an active user context. So you will need to login in the app and then upload the file.

Please take a look at the following:

http://devcenter.kinvey.com/android/guides/users#ActiveUser

http://devcenter.kinvey.com/android/guides/files#Uploading

Thanks,

Pranav

Kinvey Support

Login or Signup to post a comment