You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However on Android this is bad practice. Instead the practice should be to "just" create an HttpClient with the empty constructor. An app can then choose the handler they want to use app-wide for the entire app and all 3rd party libraries using the environment settings, with this single line call at start-up:
The problem with explicitly declaring a message handler, is that it completely overrides the http handler selection and forces whichever one you decided at that spot. So libraries shouldn't be doing this, as it prevents app developers from using whichever handler they want app-wide.
In the readme file, it's stated you should use the library this way:
However on Android this is bad practice. Instead the practice should be to "just" create an HttpClient with the empty constructor. An app can then choose the handler they want to use app-wide for the entire app and all 3rd party libraries using the environment settings, with this single line call at start-up:
The problem with explicitly declaring a message handler, is that it completely overrides the http handler selection and forces whichever one you decided at that spot. So libraries shouldn't be doing this, as it prevents app developers from using whichever handler they want app-wide.
You can see how all this works here:
https://github.com/xamarin/xamarin-android/blob/0c26b71339a1027902f72e3842077feb7d9c7d9b/src/Mono.Android/Android.Runtime/AndroidEnvironment.cs#L319-L328
It is also documented here:
https://developer.xamarin.com/guides/android/advanced_topics/environment/
https://developer.xamarin.com/guides/android/application_fundamentals/http-stack/
The text was updated successfully, but these errors were encountered: