Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to get the screen time #6

Closed
AftabUfaq opened this issue Sep 10, 2024 · 3 comments
Closed

how to get the screen time #6

AftabUfaq opened this issue Sep 10, 2024 · 3 comments

Comments

@AftabUfaq
Copy link

how can i get the screen time. For example how much time the user use his phone in last 24 hours and 7 days and in on month. i have successfully installed the dependency and get the permission but on which function you should get the time.

  useEffect(() => {
      requestScreenTime();
  }, []);

  const requestScreenTime = async () => {
    
    ScreenTime.requestAuthorization("individual").then(async () => {
      const status = await ScreenTime.getAuthorizationStatus()
      console.log('Authorization status:', status) // 'approved', 'denied', or 'notDetermined'
      let selection = await ScreenTime.displayFamilyActivityPicker("all");
      console.log('Family activity selection:', selection);
     // selection will be `null` if user presses cancel
      if (selection) {
        await ScreenTime.setActivitySelection(selection); // sets the shields
      
      }
    })
  }  
@NoodleOfDeath
Copy link
Owner

This is not fully implemented yet. You will need to also make a DeviceActivityMonitor target in Xcode

@zoobibackups
Copy link

how can i add this.

@NoodleOfDeath
Copy link
Owner

@zoobibackups you will need to add a DeviceActivityMonitor target to your Xcode project. please let me know if you have trouble doing this

@NoodleOfDeath NoodleOfDeath closed this as not planned Won't fix, can't repro, duplicate, stale Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants