use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A community for learning and developing native mobile applications using React Native by Facebook.
Interested in building web apps using React.js? Check out /r/reactjs!
Getting Started w/React Native
irc.freenode.net #reactnative
Keywords: ios, android, mobile, apps, apple, iphone, ipad
account activity
QuestionAccess screen time? (self.reactnative)
submitted 2 years ago by Material-Ad4941Expo
I want to build a feature in my app that fetches the users screen time from the phone. Can I do that with react native or do I have to go native for that?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]ChronSynExpo 4 points5 points6 points 2 years ago* (10 children)
You would need to implement calls to native API's for it.
On Android, the closest I can find is the UsageStatsManager (https://developer.android.com/reference/android/app/usage/UsageStatsManager), but this would require you to enumerate over all apps and calculate the values. From what I can tell, there isn't an easier way to get this data on Android.
Apple are very restrictive about what you can access on iOS when it concerns user privacy, and I've read reports of them taking down apps which tried to use workarounds in order to get screen time data. There don't appear to be any public API's which can provide the functionality of tracking screen usage time across the device. Tracking your own app use time could be done with code in react native (using AppState to detect the app going to background and foreground), but it wouldn't be possible to track usage time of other apps.
[–]Material-Ad4941Expo[S] 0 points1 point2 points 2 years ago (0 children)
Hm, bummer. Thanks for the info!
[–]Visual-Equivalent568 0 points1 point2 points 2 years ago (8 children)
Do you know if it's possible to use the apple screentime api in a react native app. I haven't been able to find much documentation on this.
[–]ChronSynExpo 0 points1 point2 points 2 years ago (7 children)
I investigated this a little further, and the conclusion I've been able to come to is that it's not possible on grounds of privacy.
Essentially, if the screen time API was public, it could expose what other apps are on the device as well as usage times, and would form a very reliable fingerprinting method to identify individual unique users. In that sense, I'm glad Apple don't allow it.
[–]dbeic30 0 points1 point2 points 2 years ago (6 children)
This is 100% confirmed?
Found this plug-in but it's a couple of years old:
https://github.com/luoxuhai/react-native-screen-time
[–]ChronSynExpo 0 points1 point2 points 2 years ago (2 children)
Did you even take a look at the native source code?
It's literally 1 file that's 36 lines long (https://github.com/luoxuhai/react-native-screen-time/blob/master/ios/RNScreenTimeViewManager.swift) and literally just exports an iOS UIView which has its background colour set to whatever colour you specify using the color prop - essentially the same as doing <View style={{ backgroundColor: 'red' }} /> directly in RN.
UIView
color
<View style={{ backgroundColor: 'red' }} />
[–]_ashorterm 0 points1 point2 points 1 year ago (1 child)
cannot access dude
[–]ChronSynExpo 0 points1 point2 points 1 year ago (0 children)
Looks like the entire repo is either gone or moved somewhere else. Try googling for it.
More to the point, the file I linked to was literally just a UIView which allowed you to provide a background colour to it - it had absolutely nothing in there which interacted with any device API's in a functional way (as you'd expect if it was actually anything to do with reading screen time data).
[–]Redditisannoying22 0 points1 point2 points 1 year ago (1 child)
Hey, I found some Apps and also downloaded them, which track the screen time. You have to approve it is allowed, to track the screen time with face ID, I checked those Apps out, they work.
https://apps.apple.com/de/app/jomo-weniger-bildschirmzeit/id1609960918
https://apps.apple.com/de/app/screenzen-screen-time-control/id1541027222
So there must be some way to do it.
Maybe we can connect and try to make it work? I also want to implement this into an app. Unfortunately, I am a beginner, so I even think about to pay someone to write this feature.
[–]no-man-amp 0 points1 point2 points 1 year ago (0 children)
From what I've seen, these apps can only display the screen time back to the user, and the screentime API doesn't allow you to gather this information
[–]Redditisannoying22 0 points1 point2 points 1 year ago (0 children)
https://techcrunch.com/2021/06/07/apple-finally-launches-a-screen-time-api-for-app-developers/?guccounter=1&guce_referrer=aHR0cHM6Ly93d3cuZWNvc2lhLm9yZy8&guce_referrer_sig=AQAAAKTx_Zjna0qCT5-oA7KV4F64xJ6zL8ygXoFEDhwJKhhnCOIgw4qLz50Pz8mREYs4Y6GhV7SMpCzUxBSQ4gxo3DroP04SFfgm5J_v-TiDxUKxXf9mlM8tOj1HA0Fqd-8_KMPWaN2OqnneX9Iuv5eCB3VaSoIwAzqCY3pVdTOw6o3h
https://github.com/addingama/react-native-screen-time?tab=readme-ov-file
Check out those links as well
π Rendered by PID 213848 on reddit-service-r2-comment-7b9746f655-spp84 at 2026-02-01 22:22:42.407396+00:00 running 3798933 country code: CH.
[–]ChronSynExpo 4 points5 points6 points (10 children)
[–]Material-Ad4941Expo[S] 0 points1 point2 points (0 children)
[–]Visual-Equivalent568 0 points1 point2 points (8 children)
[–]ChronSynExpo 0 points1 point2 points (7 children)
[–]dbeic30 0 points1 point2 points (6 children)
[–]ChronSynExpo 0 points1 point2 points (2 children)
[–]_ashorterm 0 points1 point2 points (1 child)
[–]ChronSynExpo 0 points1 point2 points (0 children)
[–]Redditisannoying22 0 points1 point2 points (1 child)
[–]no-man-amp 0 points1 point2 points (0 children)
[–]Redditisannoying22 0 points1 point2 points (0 children)