demo-fivvy-sdk v0.68.3
Getting started
Fivvy 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.
Installation
Please read this entire section.
npm
npm install fivvy-sdk --save
yarn
yarn add fivvy-sdk
Android
Permissions
AndroidManifest
Necesary to add this xmlns:tools insde the tag manifest on AndroidManifest insde android/app/src/main folder.
<manifest xmlns:tools="http://schemas.android.com/tools">
Need to add these permissions in the AndroidManifest inside android/app/src/main folder.
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" tools:ignore="QueryAllPackagesPermission" />
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" tools:ignore="ProtectedPermissions" />
Integration in App
On android you must request permissions beforehand
import { PermissionsAndroid } from 'react-native';
import {initContextualDataCollection, openUsageAccessSettings} from 'fivvy-sdk';
const handleInitDataCollection = async () => {
const granted = await PermissionsAndroid.request('android.permission.READ_CONTACTS',
{
title:'Permiso para acceder a contactos',
message:'Necesitamos acceder a tus contactos',
buttonPositive:'Aceptar',
buttonNegative:'Cancelar',
}
);
const readContactPermission = granted === PermissionsAndroid.RESULTS.GRANTED;
initContextualDataCollection(customerId, readContactPermission, days)
.then(data => console.log('***** contextualData:', data));
};
API
All the information about the package and how to use functions.
initContextualDataCollection(customerId: string, readContactPermission: boolean, appUsageDays: number)
: Promise - Initiates data collection, sending it to the API for saving. Receives an identification name for the customer customerId, the permission of the contacts and the time from which it collects the use of the applications.getDeviceInformation()
: Promise - returns the device hardware information of the customer.getContacts()
: Promise<IContact[]> - if have permission returns all contacts as an array of IContac; otherwise returns an EMPTY Array.openUsageAccessSettings()
- Open settings view to grant app usage permission.getAppUsage(days: number)
: Promise<IAppUsage[]> - returns an EMPTY Array if the user doesnt brings access to the App Usage or an IAppUsage Array for the all used aplications.getAppsInstalled()
: Promise<IInstalledApps[]> - returns an IInstalledApps Array for all the installed aplications of the user.
Example
You can find an example app/showcase here
Getting the installed apps
Recovery of applications installed on the user's device.
getAppsInstalled().then(data => console.log('***** apps:', data));
// expected output
***** apps: [{"name": "Camera", "packageName": "com.android.camera2"}, {"name": "Chrome", "packageName": "com.android.chrome"}, {"name": "Settings", "packageName": "com.android.settings"}, {"name": "Play Store", "packageName": "com.android.vending"}, {"name": "Drive", "packageName": "com.google.android.apps.docs"}, {"name": "Maps", "packageName": "com.google.android.apps.maps"}, {"name": "Messages", "packageName": "com.google.android.apps.messaging"}, {"name": "Photos", "packageName": "com.google.android.apps.photos"}, {"name": "YT Music", "packageName": "com.google.android.apps.youtube.music"}, {"name": "Calendar", "packageName": "com.google.android.calendar"}, {"name": "Contacts", "packageName": "com.google.android.contacts"}, {"name": "Clock", "packageName": "com.google.android.deskclock"}, {"name": "Phone", "packageName": "com.google.android.dialer"}, {"name": "Gmail", "packageName": "com.google.android.gm"}, {"name": "YouTube", "packageName": "com.google.android.youtube"}, {"name": "TMoble", "packageName": "com.android.stk"}, {"name": "Files", "packageName": "com.google.android.documentsui"}, {"name": "Voice Search", "packageName": "com.google.android.googlequicksearchbox"}, {"name": "Google", "packageName": "com.google.android.googlequicksearchbox"}, {"name": "probando_npm_module", "packageName": "com.probando_npm_module"}]
Terms of use
All content here is the property of Fivvy, it should not be used without their permission.