Installations
npm install react-native-contextual-profiler-legacy
Developer Guide
Typescript
Yes
Module System
CommonJS
Min. Node Version
>= 16.0.0
Node Version
18.17.1
NPM Version
9.6.7
Score
33.4
Supply Chain
56
Quality
66.7
Maintenance
50
Vulnerability
93.8
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Love this project? Help keep it running — sponsor us today! 🚀
Download Statistics
Total Downloads
92
Last Day
1
Last Week
2
Last Month
10
Last Year
92
Bundle Size
1.72 kB
Minified
705.00 B
Minified + Gzipped
Package Meta Information
Latest Version
0.6.0
Package Id
react-native-contextual-profiler-legacy@0.6.0
Unpacked Size
163.58 kB
Size
81.51 kB
File Count
104
NPM Version
9.6.7
Node Version
18.17.1
Published on
Jun 28, 2024
Total Downloads
Cumulative downloads
Total Downloads
92
Last Day
0%
1
Compared to previous day
Last Week
-50%
2
Compared to previous week
Last Month
150%
10
Compared to previous month
Last Year
0%
92
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Peer Dependencies
1
Dev Dependencies
20
Getting started contextual-profiler-legacy
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.
See the full API for more methods.
Recommendations
- REACT NATIVE VERSION: >= 0.68.0 (For more recent version's dont use the legacy sdk)
- ANDROID API LEVEL: 21 to 33 (we recommend 24 to 33)
- MIN JAVA VERSION: jdk11
- GRADLE DISTRIBUTION: gradle-7.3.3
Installation
Please read this entire section.
npm
npm install contextual-profiler-legacy
yarn
yarn add contextual-profiler
Android
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.0@aar'
Permissions
AndroidManifest
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
Android Permission Request
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.
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:
1import { getAppUsage, openUsageAccessSettings } from 'contextual-profiler-legacy';
2
3const getAllPermissions = async () => {
4 const appUsage = await getAppUsage(30);
5 if (appUsage === null) {
6 const haveAccess = await openUsageAccessSettings({
7 appName: 'Fivvy', // string value with your app name
8 imagePath: 'logo', // optional image name in png format without the extension - ex: logo -> logo.png
9 ln: "EN", // If selected, the default texts will be set on the modal for EN, ES, or PT. Recommended for i18n integrations
10 // If using the ln value, it is recommended not to use the parameters below as the ln sets default texts in the right language.
11 appDescription: 'Activate the permission', // optional description text. Recommended length: 3 or 4 words
12 modalText: 'Lorem ipsum text', // optional modal text. Recommended length: 3 or 4 words
13 dialogTitle: "Dialog Title",
14 dialogMessage1: "Dialog message 1",
15 dialogMessage2: "Dialog message 2"
16 });
17 }
18};
Example of use inside a view
1 useEffect(() => { 2 getAllPermissions(); 3 }, []); 4
or
1 const handleTapPermissionButton = () => getAllPermissions();
Direct Access to Settings
If you prefer not to display any modal and want to go directly to the settings screen, you can use
1openUsageAccessSettingsDirectly();
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 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},[])
API
All the information about the package and how to use functions.
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. |
Interfaces
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`getDeviceInformation return interface` 11IHardwareAttributes { 12 api_level: string; 13 device_id: string; 14 device: string; 15 hardware: string; 16 brand: string; 17 manufacturer: string; 18 model: string; 19 product: string; 20 tags: string; 21 type: string; 22 base: string; 23 id: string; 24 host: string; 25 fingerprint: string; 26 incremental_version: string; 27 release_version: string; 28 base_os: string; 29 display: string; 30 battery_status: number; 31 } 32 33 `getAppUsage return object interface` 34 IAppUsage { 35 appName: string; 36 usage: number; 37 packageName: string; 38 } 39 `getAppsInstalled return object interface` 40 IInstalledApps { 41 appName?: string; 42 packageName: string; 43 category?: string; 44 icon?: string; 45 installTime?: string; 46 lastUpdateTime?: string; 47 versionCode?: string; 48 versionName?: string; 49 } 50 `openUsageAccessSettings params object` 51 UsageSettings { 52 ln: string, 53 appDescription: string, 54 appName: string, 55 imagePath: string, 56 modalText: string 57 }
Example
You can find an example app/showcase here
Getting the installed apps
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
Terms of use
All content here is the property of Fivvy, it should not be used without their permission.

No vulnerabilities found.

No security vulnerabilities found.