ScientiaMobile.Wurfl.Microservice.Client
2.2.0
Prefix Reserved
dotnet add package ScientiaMobile.Wurfl.Microservice.Client --version 2.2.0
NuGet\Install-Package ScientiaMobile.Wurfl.Microservice.Client -Version 2.2.0
<PackageReference Include="ScientiaMobile.Wurfl.Microservice.Client" Version="2.2.0" />
paket add ScientiaMobile.Wurfl.Microservice.Client --version 2.2.0
#r "nuget: ScientiaMobile.Wurfl.Microservice.Client, 2.2.0"
// Install ScientiaMobile.Wurfl.Microservice.Client as a Cake Addin #addin nuget:?package=ScientiaMobile.Wurfl.Microservice.Client&version=2.2.0 // Install ScientiaMobile.Wurfl.Microservice.Client as a Cake Tool #tool nuget:?package=ScientiaMobile.Wurfl.Microservice.Client&version=2.2.0
ScientiaMobile WURFL Microservice Client for C#/dotNET Framework
WURFL Microservice (by ScientiaMobile, Inc.) is a mobile device detection service that can quickly and accurately detect over 500 capabilities of visiting devices. It can differentiate between portable mobile devices, desktop devices, SmartTVs and any other types of devices that have a web browser.
This is the C#/dotNET Client API for accessing the WURFL Microservice. The API is released under Open-Source and can be integrated with other open-source or proprietary code. In order to operate, it requires access to a running instance of the WURFL Microservice product, such as:
WURFL Microservice for Docker: https://www.scientiamobile.com/products/wurfl-microservice-docker-detect-device/
WURFL Microservice for AWS: https://www.scientiamobile.com/products/wurfl-device-detection-microservice-aws/
WURFL Microservice for Azure: https://www.scientiamobile.com/products/wurfl-microservice-for-azure/
WURFL Microservice for Google Cloud Platform: https://www.scientiamobile.com/products/wurfl-microservice-for-gcp/
Supported .NET Frameworks
.NET Framework | WM client version(s) |
---|---|
net8.0 | since 2.2.0 |
net7.0 | since 2.2.0 |
net6.0 | since 2.2.0 |
net5.0 | since 2.1.3 |
netcoreapp3.1 | since 2.1.2 |
netcoreapp2.2 | 2.1.1 |
net481 | since 2.2.0 |
net472 | since 2.2.0 |
net462 | since 2.2.0 |
net452 | since 2.1.3 |
Getting Started
To use this project follow the steps below:
Ensure the properly SDK are installed on your machine.
Clone or download this repository to your local machine.
Open the solution in your preferred IDE (tested with Visual Studio 2022).
Build the solution to restore NuGet packages and compile the code.
Usage
You may find an example solution of how to use the WmClient dll in the Example folder.
It is a cli app that uses the latest WmClient Nuget package.
Please refer to its source code comments for details.
Alternatively, if code is running inside a web application that provides a HttpRequest instance, you can initialize WM client inside - for example, in the global.asax file
protected void Application_Start()
{
WpcClient client = WpcClient.Create("localhost", "8081");
var requestedCapabilities = new string[]{
"brand_name",
"model_name",
"is_mobile",
"is_tablet",
"is_smartphone"
};
client.SetRequestedCapabilities(requestedCapabilities);
}
and then use it wherever it's needed, for example in a ASP MVC controller method
public ActionResult MyControllerMethod()
{
var req = System.Web.HttpContext.Current.Request;
JSONDeviceData device = client.LookupRequest(req);
[...]
}
You can also use all HTTP headers to perform a device detection:
var headers = new Dictionary<String, String>();
headers.Add("Content-Type", "application/json");
headers.Add("Accept-Encoding", "gzip, deflate");
headers.Add("Accept-Language", "en");
headers.Add("Referer", "https://www.cram.com/flashcards/labor-and-delivery-questions-889210");
headers.Add("User-Agent", "Opera/9.80 (Android; Opera Mini/51.0.2254/184.121; U; en) Presto/2.12.423 Version/12.16");
headers.Add("X-Clacks-Overhead", "GNU ph");
headers.Add("X-Forwarded-For", "110.54.224.195, 82.145.210.235");
headers.Add("X-Operamini-Features", "advanced, camera, download, file_system, folding, httpping, pingback, routing, touch, viewport");
headers.Add("X-Operamini-Phone", "Android #");
headers.Add("X-Operamini-Phone-Ua", "Mozilla/5.0 (Linux; Android 8.1.0; SM-J610G Build/M1AJQ; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/69.0.3497.100 Mobile Safari/537.36");
headers.Add("Accept", "text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1");
headers.Add("Device-Stock-Ua", "Mozilla/5.0 (Linux; Android 8.1.0; SM-J610G Build/M1AJQ; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/69.0.3497.100 Mobile Safari/537.36");
headers.Add("Forwarded", "for=\"110.54.224.195:36350\"");
// Perform a device detection calling WM server API passing the whole request headers
JSONDeviceData device = client.LookupHeaders(headers);
Contributing
We want you to know that contributions to this project are welcome. Please open an issue or submit a pull request if you have any ideas, bug fixes, or improvements.
License
This project is released under Apache-2.0 license.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.1 is compatible. |
.NET Framework | net452 is compatible. net46 was computed. net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 was computed. net481 is compatible. |
-
- Microsoft.AspNet.WebApi.Client (>= 6.0.0)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.2.0 | 90 | 11/11/2024 |
2.2.0 - Enh: Package refactoring - Added support for NET 6, 7, 8 and Net Framework 4.6.2, 4.7.2 ,4.8.1
2.1.4 - Ehn: Updated dependencies to fix vulnerability
2.1.3 - Ehn: Added support for NET 5
2.1.2 - Fix: Could not load file or assembly 'System.Net.Http.Formatting' error.Set target framework to netcoreapp 3.1
2.1.1 - Ehn: Added cache usage tests. Used HTTP headers in samlple app detection.
2.1.0 - Fix: added LookupHeaders method in client. Improved tests.
2.0.4 - Fix: naming issue in .NET Core package
2.0.3 - Added support for .NET Core framework 2.2.0 (not included in this package)
2.0.2 - Better packaging and info for NuGet release
2.0.1 - Initial release