One of the features of CycleBike is to upload activities to Strava. The developer must ask the user to sign-in and authorize CycleBike to write an activity to their account. In addition to using the arcane Android “WebView” widget, the developer must use “OAuth2” to exchange an authorization token for an access token using their client ID and secret code. No-one should have to know this. https://developers.strava.com/docs/authentication/
It would be nice if they had example code in Java for Android developers, but they use C. Somehow I managed to get it working using the DefaultHTTPClient Class in Android. A visit to the dentist is less painful.
Now, in their wisdom, Strava has decided that this is not secure enough and the developer must now exchange the access token for a ”refresh token” before each upload. Also, Google has “deprecated” the DefaultHTTPClient Class, which now has to run in a Worker Thread anyway. That's their way of fixing bugs: deprecate and move on.
So I had to learn the “Volley” Class in Android to do a JsonObject Http POST request to exchange my access token for a refresh token with Strava. Also now there must be an active internet connection for this exchange before uploading the file. Previously I could just put this upload task in a queue to execute later. Now I have to ask the user to turn on internet. A root canal is less painful.