Skip to content

BastiJD/rn-usage

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

6 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

@brighthustle/react-native-usage-stats-manager

Usage Stats Manager Plugin

Installation

npm install @brighthustle/react-native-usage-stats-manager

Android

Permission need to be added on AndroidManifest.xml

<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" />

If Build Error on kotlin add kotlinVersion to the gradle.properties

kotlinVersion=1.8.10

Usage

import {
  EventFrequency,
  checkForPermission,
  queryUsageStats,
  showUsageAccessSettings,
} from '@brighthustle/react-native-usage-stats-manager';

Time needs to be in millisecond for function queryUsageStats

const startDateString = '2023-06-11T12:34:56';
const endDateString = '2023-07-11T12:34:56';

const startMilliseconds = new Date(startDateString).getTime();
const endMilliseconds = new Date(endDateString).getTime();

const result = await queryUsageStats(
      EventFrequency.INTERVAL_DAILY,
      startMilliseconds,
      endMilliseconds
    )

Check Permission & Open Permission Activity

checkForPermission().then((res: any) => {
  if (!res) {
    showUsageAccessSettings('');
  }
});

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library

About

Track user interactions in your React Native app with ease using the Android Usage Stats package, now available in React Native, brought to you by Codesyncr. Optimize user experience based on data-driven insights. ๐Ÿ“Š๐Ÿ“ฑ #ReactNative #UserAnalytics #CodeSyncr

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Kotlin 53.7%
  • TypeScript 16.2%
  • Java 11.9%
  • Ruby 6.7%
  • JavaScript 5.0%
  • Objective-C 4.0%
  • Other 2.5%