Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

NSUrlSessionConfiguration equivalent android xamarin

Hi,

Anyone know equivalent for NSUrlSessionConfiguration to implement in xamarin.android to implement.

below is code for IOS. can anyone tell me the code for xamarin.android equivalent to it?

using (var sessionConfig = UIDevice.CurrentDevice.CheckSystemVersion(8, 0)
? NSUrlSessionConfiguration.CreateBackgroundSessionConfiguration(Identifier)
: NSUrlSessionConfiguration.BackgroundSessionConfiguration(Identifier))
{
sessionConfig.NetworkServiceType = NSUrlRequestNetworkServiceType.Default;
this.session = NSUrlSession.FromConfiguration(sessionConfig, new UrlSessionDelegate(m_selectedEBook), NSOperationQueue.MainQueue);
}
ThreadPool.QueueUserWorkItem(async(object state) =>
{
using (var url = NSUrl.FromString(downloadURL.PdfDownloadUrl))
{
using (var request = NSUrlRequest.FromUrl(url))
{
downloadTask = session.CreateDownloadTask(request);
downloadTask.Resume();
}
}
}

Tagged:
Sign In or Register to comment.