I am converting, from Xamarin to MAUI, a working Android/iOS app that uses the .NET Dropbox API (specifically the Dropbox.Api V7.7.0 Nuget).
Here is a segment of working Xamarin code:
DropboxClientConfig dropboxClientConfig = new DropboxClientConfig () { HttpClient = new HttpClient ( new HttpClientHandler () ) };
DropboxClient dbx = new DropboxClient ( refreshToken, clientId, dropboxClientConfig );
…
…
using ( var response = await dbx.Files.DownloadAsync ( filepath ) )
{
return await response.GetContentAsStringAsync ();
}
On MAUI Android, the call to DownloadAsync fails with the message
Dropbox.Api.BadInputException: Error in call to API function “files/download”:
Bad HTTP “Content-Type” header: “application/x-www-form-urlencoded".
Expecting one of “text-plain”, “text-plain; charset =utf-8”, “application/octet-stream”, …..
This is the same message that I got at this point while developing the original Xamarin app. At that time, the fix was the addition of the dropboxClientConfig argument, which had the effect of replacing the native Android handler with the .NET one.
However, on MAUI, this fix does not appear to have any effect. (One suggestion in this forum is to make sure you are not on the main UI thread, and I am not.)
MAUI and Xamarin are not officially supported by Dropbox, but perhaps another user has run into this problem?