Fivvy.FivvyBinding 1.0.0-beta2

This is a prerelease version of Fivvy.FivvyBinding.
dotnet add package Fivvy.FivvyBinding --version 1.0.0-beta2
                    
NuGet\Install-Package Fivvy.FivvyBinding -Version 1.0.0-beta2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Fivvy.FivvyBinding" Version="1.0.0-beta2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Fivvy.FivvyBinding" Version="1.0.0-beta2" />
                    
Directory.Packages.props
<PackageReference Include="Fivvy.FivvyBinding" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Fivvy.FivvyBinding --version 1.0.0-beta2
                    
#r "nuget: Fivvy.FivvyBinding, 1.0.0-beta2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Fivvy.FivvyBinding@1.0.0-beta2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Fivvy.FivvyBinding&version=1.0.0-beta2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Fivvy.FivvyBinding&version=1.0.0-beta2&prerelease
                    
Install as a Cake Tool

Getting started Fivvy contextual-profiler

Contextual Profiler SDK offers a comprehensive and efficient solution for collecting valuable information about your users. With this powerful tool, you will be able to gather relevant data that will allow you to conduct in-depth analysis and gain a clear understanding of your users' behavior, preferences, and needs.

Official binding of the Fivvy SDK for Android, adapted for .NET MAUI Android applications.

⚠️ Important Notice: This library does not support iOS devices.

Please be aware that this library is currently only available for Android. It will not work on iOS devices. Ensure that your project is intended for Android platforms before integrating this library.

🛠️ Requirements

  • .NET MAUI targeting net9.0-android or higher
  • Android SDK level 24+

📦 Installation

Install via NuGet:

dotnet add package FivvyMauiAndroidBinding --version 1.0.0-beta1

Or add it to your .csproj:

<PackageReference Include="FivvyMauiAndroidBinding" Version="1.0.0-beta1" />

Permissions

AndroidManifest

Necesary to add this xmlns:tools insde the tag manifest on AndroidManifest inside /Platforms/Android folder.

<manifest xmlns:tools="http://schemas.android.com/tools">

Need to add these permissions in the AndroidManifest inside /Platforms/Android folder.

<uses-permission  android:name="android.permission.INTERNET" />
<uses-permission  android:name="android.permission.PACKAGE_USAGE_STATS"  tools:ignore="ProtectedPermissions" />

<queries>
    
    <package android:name="com.whatsapp"/> 
    <package android:name="com.facebook.katana"/> 
    <package android:name="com.mercadopago.android"/> 
    

</queries>

Get User Permission to Check App Usage

We have a pre-made modal with instructions that can be used for this purpose. Here is an example of how to implement it:

#if ANDROID
using FivvyMauiAndroidBinding.FivvyBinding;
#endif

... // Your code

var context = Platform.CurrentActivity;
var blacklist = new List<string>();

ContextualProfiler.OpenUsageSettingsModal(
    context, // 
    "ES", // Language: If selected, the default texts will be set on the modal for EN, ES, or PR.
    "MAUI App", // App Name: string value with your app name
    "demo", // App Desription: optional description text. Recommended length: 3 or 4 words
    "logo", // Image Name: this image should be in Platform/Android/Resources/drawable/logo.png
    2, // Image view: integer value, 0: no image; 1: default image, 2: app logo
    5f, // Button radius: float value, set button border radius
    10f, // Modal radius: float value, set modal border radius
    "#000000", // Color: hex color value, set color of dialog title, accept background color and cancel button text color
    "Modal Text", // Modal text: optional modal text. Recommended length: 3 or 4 words
    "Title", // Modal title: Title of the dialog displayed to the user before redirecting to the settings screen for permissions.
    "Description 1", // Modal message 1: Custom Message of the dialog displayed to the user before redirecting to the settings screen for permissions.
    "Description 2", // Modal message 2: Other custom Message of the dialog displayed to the user before redirecting to the settings screen for permissions.
    blacklist // (Optional) List of device manufacturers for which the usage settings should be avoided. On some devices, especially from certain manufacturers as Xiaomi, a system warning might be displayed when attempting to access the usage settings. To prevent this action on those devices, you can:

      //- Pass `null`: This will apply a default list of manufacturers known to have this issue.
      // - Provide a custom list of manufacturers as an array (`["manufacturer1", "manufacturer2"]`): This will prevent the settings from being accessed only on devices from those specific brands.
      //- Pass an empty array `[]`: This will allow the settings to be accessed on all devices without any restrictions.
);

Direct Access to Settings

If you prefer not to display any modal and want to go directly to the settings screen, you can use

#if ANDROID
using FivvyMauiAndroidBinding.FivvyBinding;
#endif

... // Your code

var context = Platform.CurrentActivity;
var blacklist = new List<string>();
ContextualProfiler.OpenUsageSettingsDirectly(context, blacklist);
// - blacklist (Optional) List of device manufacturers for which the usage settings should be avoided. On some devices, especially from certain manufacturers as Xiaomi, a system warning might be displayed when attempting to access the usage settings. To prevent this action on those devices, you can:

      //- Pass `null`: This will apply a default list of manufacturers known to have this issue.
      // - Provide a custom list of manufacturers as an array (`["manufacturer1", "manufacturer2"]`): This will prevent the settings from being accessed only on devices from those specific brands.
      //- Pass an empty array `[]`: This will allow the settings to be accessed on all devices without any restrictions.

blacklist Parameter

The blacklist parameter is an array of strings containing the names of device manufacturers for which you want to disable a certain function. If the device is from a manufacturer listed in this array, the function will not perform any action.

blacklist Behavior:

  • Array with specific manufacturers: If the array contains manufacturer names, the function will be disabled on devices from those brands. Example:
List<String> blacklist = ["xiaomi", "huawei"]
  • Empty Array: The feature will work on any manufacturer device. Example:
  List<String> blacklist = []
  • Null value: The feature will use a default blacklist, here are the default blacklisted manufacturers: ["xiaomi", "huawei", "oppo", "vivo", "realme", "lenovo", "meizu", "oneplus", "zte", "nubia"]
 List<String>? blacklist = null

Here's a full list of manufacturers names in Android: Android manufacturer names

Send data to Fivvy's analytics service

This function will allow your app to send the information of each user to the Fivvy Analytic's API. You must add on some view or loading component that can send the data at least 1 time a day.

Every time this function run, the data will be send to the Fyvvy's API.

#if ANDROID
using FivvyMauiAndroidBinding.FivvyBinding;
#endif

... // Your code
var contextAct = Platform.CurrentActivity;
ContextualProfiler.InitContextualDataCollection(
    contextAct,
    "MAUI", // customerId: Represents an identifier of the current user
    30,     // days: Integer that represents the last days to recollect the app usage information of the user
    "API_KEY", // ApiKey of Fivvy's API
    "API_SECRET", // ApiSecrey of Fivvy's API
    AUTH_API_URL, // URL of the Fivvy's Auth API
    SEND_DATA_API_URL // URL of the Fivvy's Analytics Data API
);

API

All the information about the package and how to use functions.
Methods Params value Return value Description
InitContextualDataCollection (Context context, String customerId, int appUsageDays, String apiKey, String apiSecret, String authApiUrl, String sendDataApiUrl) ContextualData Initiates data collection, sending it to the Fivvy's Analytics Data API.
GetDeviceInfo (Context context) IHardwareAttributes Returns the device hardware information of the customer.
GetAppUsageInfo (Context context, int days) days. Represent the last days to get the usage of each app. List<IAppUsage> Returns an IAppUsage Array for all the queries in AndroidManifest that user had install in his phone or null if user doesn’t bring usage access. Returns null if the user doesnt brings access to the App Usage or an IAppUsage Array for the all used aplications.
GetAppInstalledInfo (Context context) List<IInstalledApps> Returns an IInstalledApps Array for all the queries in AndroidManifest that user had install in his phone.
OpenUsageSettingsModal (Activity context, String ln, String appName, String appDescription, String imageName, int imageView, float buttonRadius, float modalRadius, String color, String modalText, String dialogTitle, String dialogMessage1, String dialogMessage2, List<String>? blacklist) Boolean Open settings view with a modal helper to grant app usage permission.
OpenUsageSettingsDirectly (Context context, List<String>? blacklist) Open settings view without pre-built modal to grant app usage permission.

Example

Getting the installed apps

Recovery of applications installed on the user's device.

var context = Android.App.Application.Context;
var installedApps = ContextualProfiler.GetAppInstalledInfo(context);
string appInstalledInfoString = string.Join(", ", installedApps.Select(app => app.ToString()));
//  expected output
  Installed Apps: [{"appName": "WhatsApp", "category": "Social", "installTime": "2023.02.15 20:07:35", "lastUpdateTime": "2023.08.16 14:52:12", "packageName": "com.whatsapp", "versionCode": "231676002", "versionName": "2.23.16.76"}]

General Information

⚠️ Important Notice: iOS Compatibility

This library is not compatible with iOS devices. It is specifically designed for Android platforms, and no support for iOS is provided. Please refrain from using this library in iOS-based projects, as it will not function as intended.

Terms of use

All content here is the property of Fivvy, it should not be used without their permission.

Product Compatible and additional computed target framework versions.
.NET net9.0-android35.0 is compatible.  net10.0-android was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.0.0-beta2 127 4/30/2025
1.0.0-beta1 136 4/28/2025