Gathering detailed insights and metrics for @fivvy/react-native-contextual-profiler-legacy
Gathering detailed insights and metrics for @fivvy/react-native-contextual-profiler-legacy
npm install @fivvy/react-native-contextual-profiler-legacy
Typescript
Module System
Min. Node Version
Node Version
NPM Version
33.6
Supply Chain
56
Quality
77.2
Maintenance
50
Vulnerability
93.8
License
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
2,281
Last Day
9
Last Week
38
Last Month
177
Last Year
2,281
Minified
Minified + Gzipped
Latest Version
1.0.2
Package Id
@fivvy/react-native-contextual-profiler-legacy@1.0.2
Unpacked Size
165.98 kB
Size
81.81 kB
File Count
104
NPM Version
10.5.2
Node Version
20.13.1
Published on
Aug 20, 2024
Cumulative downloads
Total Downloads
Last Day
800%
9
Compared to previous day
Last Week
322.2%
38
Compared to previous week
Last Month
78.8%
177
Compared to previous month
Last Year
0%
2,281
Compared to previous year
1
20
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.
⚠️ 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.
See the full API for more methods.
Please read this entire section.
npm install @fivvy/react-native-contextual-profiler-legacy
yarn add @fivvy/react-native-contextual-profiler-legacy
you MUST add this line to build.gradle (proyect)
1 2allprojects { 3 repositories { 4 google() 5 mavenCentral() 6 maven { 7 url "https://gitlab.com/api/v4/projects/58175283/packages/maven" 8 } 9 } 10}
and in build.gradle (app)
1 implementation 'com.fivvy:fivvy-lib:1.1.1@aar'
Necesary to add this xmlns:tools insde the tag manifest on AndroidManifest insde android/app/src/main folder.
1<manifest xmlns:tools="http://schemas.android.com/tools">
Need to add these permissions in the AndroidManifest inside android/app/src/main folder.
1<uses-permission android:name="android.permission.INTERNET" /> 2<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" tools:ignore="ProtectedPermissions" /> 3 4<queries> 5 <!-- List of package's [Max 100] --> 6 <package android:name="com.whatsapp"/> <!-- WhatsApp Messenger --> 7 <package android:name="com.facebook.katana"/> <!-- Facebook --> 8 <package android:name="com.mercadopago.android"/> <!-- Mercado Pago --> 9 <!-- ... --> 10 11 </queries> 12 13
On Android, you must request permissions beforehand to check the app's usage. We recommend creating a logic with AsyncStorage to remember if the user doesn't want to give access to this permission.
We have a pre-made modal with instructions that can be used for this purpose. Here is an example of how to implement it:
1import { getAppUsage, openUsageAccessSettings } from 'contextual-profiler-legacy';
2 openUsageAccessSettings({
3 appName: 'Fivvy', // string value with your app name
4 imagePath: 'logo', // optional image name in png format without the extension - ex: logo -> logo.png this image should be in android/app/src/main/res/drawable/logo.png
5 ln: "EN", // If selected, the default texts will be set on the modal for EN, ES, or PR.
6 appDescription: 'Activate the permission', // optional description text. Recommended length: 3 or 4 words
7 modalText: 'Lorem ipsum text', // optional modal text. Recommended length: 3 or 4 words
8 dialogTitle: "Dialog Title", // Title of the dialog displayed to the user before redirecting to the settings screen for permissions.
9 dialogMessage1: "Dialog message 1", // Custom Message of the dialog displayed to the user before redirecting to the settings screen for permissions.
10 dialogMessage2: "Dialog message 2" // Other custom Message of the dialog displayed to the user before redirecting to the settings screen for permissions.
11 });
If you prefer not to display any modal and want to go directly to the settings screen, you can use
1openUsageAccessSettingsDirectly();
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 useEffect run, the data will be send to the Fyvvy's API.
1 useEffect(() => { 2 const contextualConfigObj = { 3 customerId: customerId, // Represents an identifier of the current user 4 apiKey: API_KEY, // ApiKey of Fivvy's API 5 apiSecret: API_SECRET, // ApiSecrey of Fivvy's API 6 appUsageDays: DAYS, // Integer that represents the last days to recollect the app usage information of the user 7 authApiUrl: AUTH_API_URL, // URL of the Fivvy's Auth API 8 sendDataApiUrl: SEND_DATA_API_URL // URL of the Fivvy's Analytics Data API 9 } 10 await initContextualDataCollection(contextualConfigObj); 11},[])
Methods | Params value | Return value | Description |
---|---|---|---|
initContextualDataCollection | InitConfig {customerId: String , apiKey: String , apiSecret: String , appUsageDays: Int , authApiUrl: String , sendDataApiUrl: String } | ContextualData | Initiates data collection, sending it to the Fivvy's Analytics Data API. |
getDeviceInformation | Empty | Promise<IHardwareAttributes> | Returns the device hardware information of the customer. |
getAppUsage | Int days. Represent the last days to get the usage of each app. | Promise<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. |
getAppsInstalled | Empty | Promise<IInstalledApps[]> | Returns an IInstalledApps Array for all the queries in AndroidManifest that user had install in his phone. |
openUsageAccessSettings | UsageSettings {ln: string , appDescription: string , appName: string , imagePath: string , modalText: string } | Boolean | Open settings view with a modal helper to grant app usage permission. |
openUsageAccessSettingsDirectly | Empty | Boolean | Open settings view without pre-built modal to grant app usage permission. |
Here you can find the interaces that sdk uses
1`initContextualCollectionData param object interface` 2 InitConfig { 3 customerId: string, 4 apiUsername: string, 5 apiPassword: string, 6 appUsageDays: number, 7 authApiUrl: string, 8 sendDataApiUrl: string 9 } 10 11`getDeviceInformation return interface` 12IHardwareAttributes { 13 api_level: string; 14 device_id: string; 15 device: string; 16 hardware: string; 17 brand: string; 18 manufacturer: string; 19 model: string; 20 product: string; 21 tags: string; 22 type: string; 23 base: string; 24 id: string; 25 host: string; 26 fingerprint: string; 27 incremental_version: string; 28 release_version: string; 29 base_os: string; 30 display: string; 31 battery_status: number; 32 } 33 34 `getAppUsage return object interface` 35 IAppUsage { 36 appName: string; 37 usage: number; 38 packageName: string; 39 } 40 41 `getAppsInstalled return object interface` 42 43 IInstalledApps { 44 appName?: string; 45 packageName: string; 46 category?: string; 47 icon?: string; 48 installTime?: string; 49 lastUpdateTime?: string; 50 versionCode?: string; 51 versionName?: string; 52 }
Recovery of applications installed on the user's device.
1getAppsInstalled().then(data => console.log('Installed apps:', data)); 2// expected output 3 Installed Apps: [{"appName": "WhatsApp", "category": "Social", "icon": "iVBORw0KGgoAAAANSUhEUg", "installTime": "2023.02.15 20:07:35", "lastUpdateTime": "2023.08.16 14:52:12", "packageName": "com.whatsapp", "versionCode": "231676002", "versionName": "2.23.16.76"}] 4
⚠️ 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.
All content here is the property of Fivvy, it should not be used without their permission.
No vulnerabilities found.
No security vulnerabilities found.