Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/griesoft/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.
https://github.com/griesoft/gdprinfo
dotnet gdpr library maui
Last synced: 17 days ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/griesoft/gdprinfo
- Owner: griesoft
- License: mit
- Created: 2019-10-01T20:31:50.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-31T21:01:17.000Z (almost 2 years ago)
- Last Synced: 2024-12-03T18:49:27.541Z (about 1 month ago)
- Topics: dotnet, gdpr, library, maui
- Language: C#
- Homepage:
- Size: 282 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# 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.
[![Build Status](https://dev.azure.com/griesingersoftware/GDPRInfo%20Plugin/_apis/build/status/GdprInfo%20CI?branchName=master)](https://dev.azure.com/griesingersoftware/GDPRInfo%20Plugin/_build/latest?definitionId=34&branchName=master)
[![NuGet](https://badgen.net/nuget/v/GdprInfo)](https://www.nuget.org/packages/GdprInfo)
[![GitHub Release](https://badgen.net/github/release/griesoft/gdprinfo)](https://github.com/griesoft/gdprinfo/releases)## Installation
Install via [NuGet](https://www.nuget.org/packages/GdprInfo/) using:
``PM> Install-Package GdprInfo``
## Usage
### Registration
Register the service in your `MauiProgram` file.```csharp
using GdprInfo;public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp()
// Other services before...
.ConfigureGdprInfo()
// Other service after...
;return builder.Build();
}
}
```### Consumption:
Inject the service via dependency injection in the constructor of the depending class.
```csharp
private readonly IGdprInfoService _gdprInfoService;public MyConstructor(IGdprInfoService gdprInfoService)
{
_gdprInfoService = gdprInfoService;
}
```Check if device is in European Economic Area (EEA):
```csharp
bool result = _gdprInfoService.IsDeviceInEeaOrUnknow;
```You can also get the ISO country code of the current device
```csharp
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:
```csharp
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.