Is it possible to access battery usage/time on screen information of all applications in iOS? - ios

Sorry if the question is worded poorly. Basically I'm trying to programmatically access the time on screen data that you see in the picture (for example 7.5 hrs on screen for Reddit). Is this something that is possible to do?

Short answer: No it's impossible.
iOS since first versions is a sandbox OS. It means that each app can only access to their documents and root folder but doesn't have access to other app. But Apple, add some mechanisms to share datas between apps (like app groups). But these mechanisms doesn't work for system app. React Native is based on iOS native implementation.
You can only got the total amount of battery using libraries : (react-native) How to detect the battery level in react native?
More about sandbox : https://en.wikipedia.org/wiki/Sandbox_(computer_security)

Related

How to change Screen Time and Privacy restrictions settings programatically from inside an app or from an external MDM?

IOS 12 introduced some basic screen time settings.
Is there any way to view or change these settings programatically from inside an app or from an external MDM?
Specifically, I would like to be able to change the time limits, the downtime schedule, and/or the list of allowed apps. Ideally from the parent device but from the child device or from an MDM would be acceptable too.
I want a solution like an existing application did.(https://itunes.apple.com/us/app/id981066103 Parental Control - Screen Time)
I'm really interested in this as well, and can share my findings with you here:
There is no possible way to use the screen time / API at the time of writing. Since apps use .entitlements now, private APIs are out of the question as well.
Apple is most likely thinking about releasing a screen time API, since the feature is added in the iOS Simulator.
Apple is rejecting and removing screen time apps for no apparent reason right now.
There is one solution for now though: use MDM. The mobile device management system does not allow you to change the screen time settings on the device, but you do have control over what apps are allowed to be opened. Bind this to some date/time logic and you have a simplified version of the screen time app. The same function can also be used to track the time an app has been opened.
The app you mentioned uses the above MDM solution as well. (Actually, all apps do)

Can an iOS app determine the other apps that are on the iphone and what permissions they have?

I'm wondering if an app has access to the info that shows the other apps on the phone and what permissions they have (i.e. access to your location, contacts, etc).
Could I create an iOS app with a feature that displays other apps and their permissions? I know the user can view this info via settings, but I'm wondering if it can be organized and displayed by an app.
a similar question was asked here:
How an app to know what other apps have been installed in the device
but the solution method (iHasApp) only works for about 50% of apps, and doesn't address seeing the permissions of those apps.
Thanks!
No you can't access apps data due to sandbox structure upto iOs7.

Dynamically Blocking Websites and Apps in IOS

We are building an app which will requires to dynamically (in real time) block off users from browsing certain websites or installing/accessing certain apps.
There will be constantly updated list of URL or, Apps that the users simply cannot browse or install from the devices on which this app is installed.
Will greatly appreciate any suggestions on whats possible and how can we go about to implement this?
On the App Store this is not possible.
In the enterprise you can control various aspects of user's iOS device. See for example http://www.csoonline.com/article/2133931/identity-access/mobile-device-management-companies-get-more-app-control-on-ios-7.html
But this is not under the control of an app but IT administration.

Installed App Sizes Vs Appstore app sizes

Here is a question that had been bothering me. The other day I checked my wife's phone and pinterest app was eating up 2 GB of space while the actual app in the appstore is 26.8 MB. I know there must be user / log / crash data that is dumped in its apps document directory but that got me thinking how many other apps on her phone had large amount of user data stored compared to what the app size is in appstore.
So here are my questions of how to do all this using objectiveC
Sample Xcode iHasApp display's all the available apps installed on a device. Is there a way I check how much space they are taking in GB/MB etc?
Is there a way I can go query that app build size in appstore and tell the user hey its only X MB in appstore?
I know I can get to all the app installed on a device is there a way I can check when was an app last launched or used by a user?
Can I check how much space photo / video and music is taking up?
What I am trying do in the end is to see if I can make an app that shows user what they got installed on their device and make some informed decisions themselves.
So far all I am able to find is how to check total used and free space on a device and get a list of all apps installed.
Sample Xcode iHasApp display's all the available apps installed on a device. Is there a way I check how much space they are taking in GB/MB etc?
No. The APIs being used by iHasApp can only be used to check whether selected applications are present -- basically, all you get to ask "is ThisApp installed?", and you can build up a partial list of installed applications by running that check for a large number of common applications.
There is no way to get launch or disk usage information for other applications. I'm not sure last launch is even tracked at all by the device.
With this in mind, most of your other questions are irrelevant. It is not possible to do what you're after from an iOS application.

How can I get the information which app is foreground in iOS?

Can I get the information about which apps are on foreground, so that controlling the screen and get interaction from user.
I can do it on Android and I want to do it also in iOS.
This is for making an app that monitoring the usages of apps, not for the CPU usage.
Please tell me how could I manage this ?
On jailbroken devices, a quite straighforward solution is to use Ryan Petrich's AppList library.
I'm not sure if this is easy on a stock device, but you might get somewhere using the Mach/XNU API for retrieving process info and searching for a suspected app executable path/name.

Resources