GdprInfo 1.0.2
See the version list below for details.
dotnet add package GdprInfo --version 1.0.2
NuGet\Install-Package GdprInfo -Version 1.0.2
<PackageReference Include="GdprInfo" Version="1.0.2" />
paket add GdprInfo --version 1.0.2
#r "nuget: GdprInfo, 1.0.2"
// Install GdprInfo as a Cake Addin #addin nuget:?package=GdprInfo&version=1.0.2 // Install GdprInfo as a Cake Tool #tool nuget:?package=GdprInfo&version=1.0.2
GdprInfo
A .NET MAUI package for Android and iOS with the main purpose of detecting if the current device is in the EEA, which would make it subject to the GDPR regulation.
Installation
Install via NuGet using:
PM> Install-Package GdprInfo
Usage
Registration
Register the service in your MauiProgram
file.
using GdprInfo;
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
// Other services before...
.ConfigureGdprInfo()
// Other service after...
;
return builder.Build();
}
}
Consumption:
Inject the service via dependency injection in the constructor of the depending class.
private readonly IGdprInfoService _gdprInfoService;
public MyConstructor(IGdprInfoService gdprInfoService)
{
_gdprInfoService = gdprInfoService;
}
Check if device is in European Economic Area (EEA):
bool result = _gdprInfoService.IsDeviceInEeaOrUnknow;
You can also get the ISO country code of the current device
string? isoCode = _gdprInfoService.IsoCountryCode;
If the ISO code is not null and is part of the EEA, you can also get additional information about the country like this:
string? countryName = _gdprInfoService.CountryName;
string? countryNumber = _gdprInfoService.CountryNumber;
string? longCountryCode = _gdprInfoService.LongCountryCode;
How does it work
The service first tries to get the ISO country code via the device telemetry data i.e. network and SIM provider information. If we can't get it from there we look it up from the device's current local setting. Reasons for why we couldn't receive it from telemetry data could be for example that the device is in Flight Mode or that the device has no SIM card inserted at all.
In case that we couldn't receive the ISO code (unknown), we always have to assume that the device owner is in the EEA. So if the ISO code is unknown, IsDeviceInEeaOrUnknow
will return true
.
Project State
The project is kind of archived. I do occasional updates as I require them for personal use, but to be honest, in the mean time there are much better ways of doing what this package was trying to do.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-android33.0 is compatible. net6.0-ios was computed. net6.0-ios15.4 is compatible. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. 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 was computed. 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. |
-
net6.0
- No dependencies.
-
net6.0-android33.0
- No dependencies.
-
net6.0-ios15.4
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.