Get other apps usage info in React Native Android

1.3k Views Asked by At

I want to get information of other apps usage. Like user used whatsapp for 30min today and similarly for other apps too. How can I get it in React Native Android.

In app usage data in react native

For example User used whatsapp for 30min today, instagram for 50min and email for 2h

1

There are 1 best solutions below

0
user18309290 On

UsageStatsManager provides access to device usage history and statistics. Usage data is aggregated into time intervals: days, weeks, months, and years.

The challenge will be to get a user to grant needed permission.

Most methods on this API require the permission android.permission.PACKAGE_USAGE_STATS. However, declaring the permission implies intention to use the API and the user of the device still needs to grant permission through the Settings application.

Native module allows to access Android’s APIs from JavaScript.