Giter Club home page Giter Club logo

Comments (7)

truizlop avatar truizlop commented on June 4, 2024

Are you enabling debug on the StravaConfig?

StravaConfig config = StravaConfig.withToken(TOKEN)
                                  .debug()
                                  .build();

That may help to visualize what is being serialized incorrectly to JSON. Also, make sure the path to the GPX file is correct.

from stravazpot-android.

starryalley avatar starryalley commented on June 4, 2024

Thanks for the quick answer. I found out that I am using the wrong StravaConfig instance to call the API. Now it is working perfectly fine! I'll close this issue soon but one more question about the UploadAPI.

According to Strava document, only "data_type" and "file" is required when uploading. Is there any design reason why we should fill in all fields (such as name, description, etc) before we can execute() it?

Thanks again for the support.

from stravazpot-android.

truizlop avatar truizlop commented on June 4, 2024

No, the Upload API lets you omit those parameters which are not required by Strava. You simply omit the call to the method and it will check internally:

UploadStatus uploadStatus = uploadAPI.uploadFile(new File(gpxDir, filename))
                    .withDataType(DataType.GPX)
                    .execute();

from stravazpot-android.

starryalley avatar starryalley commented on June 4, 2024

I might have missed something but I got this exception if I only call withDataType():

upload failed with exception:java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.sweetzpot.stravazpot.upload.model.UploadActivityType.toString()' on a null object reference

from stravazpot-android.

truizlop avatar truizlop commented on June 4, 2024

I'm sorry, you are right. All parameters are required at this point. According to Strava docs, it does not state that they are optional though, so you will need to set appropriate values to all the parameters.

from stravazpot-android.

starryalley avatar starryalley commented on June 4, 2024

Thanks for confirmation. I did read the code and found out so. Didn't know if it's design choice or not since I am only using the upload API part. Thanks again for this awesome library!

from stravazpot-android.

truizlop avatar truizlop commented on June 4, 2024

Thank you for using it!

from stravazpot-android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.