Programmatically get application usage from Screen Time in iOS 12 - ios

I am working on one project and I want to get other application usage time. apple has launched iOS 12 and provides the new feature Screen Time. I want to know is there any way or API provided by Apple to get data from it.

No, on iOS each app runs in its own sandbox and cannot see data from other apps, even apps from the same publisher. An app can access special shared data, like photos from the album or contact data, but it is not possible for an app to directly access files written by other apps.
ScreenTime application is on another sandbox than your app. Unless apple provide API we can't access the same.
Update
Since apple have added screen time app into ios12 simulator. There could be a chance they provide the API's soon.

On iOS 15 Apple has added an API, see here:
https://developer.apple.com/documentation/FamilyControls
FamilyControls
Authorize your app to provide parental controls on a
child’s device. To authorize your parental controls app, use a shared
AuthorizationCenter instance. You can authorize parental controls only
on a device that is part of a Family Sharing group and signed into a
child’s iCloud account.
You must add the Family Controls capability to your app.

This seems to provide functionality to parental control apps only. In other words, it cannot be used by other time-tracking or productivity apps at the moment.

Related

IOS: App rejected because of App Tracking Transparency on WebView

I'm working on an app made in React Native with Expo.
It uses a web view to show the site in the app.
Everything worked well, but when I submitted my app to the App Store, it got rejected.
The mail said:
We noticed you collect data to track after the user selects "Ask App
Not to Track" on the App Tracking Transparency permission request.
Specifically, we noticed your app accesses web content you own and
collects cookies for tracking after the user asked you not to track
them.
After that, using the expo tracking transparency library, I added a permission request to track data.
If the user doesn't accept it, I disable third party cookies on the web view.
After submitting again to the App Store, I got the exact same message.
I don't know what to do, because I can't control the site, and I'm limited to the React Native web view props
Maybe, I could enable incognito mode if the user doesn't want the app to track, but I'm not sure if this will be accepted too.
i had the same issue i solved it like this:
change the privacy of the app on apple store, go to app privacy and in data types section click edit and select Identifiers (Device ID) and set this one as used for tracking purposes. and make sure that this is the only one selected as used for tracking.
also make sure that the permission is showing on real device (so test it first on TestFlight).
another thing is you need to tell them where you show this permission send them video to tell them where you show the permission.

How to activate and open my app as soon as I unlock my screen in iOS devices

I'm managing few iOS devices, so I want to create a app to add security feature like collecting the user information from the user like UserID to track which user is currently using the device .
Desired output:
So I want to trigger my app as soon as a user unlock the device and without giving the details the user should not able to access the home screen of the Device.
Is it possible to do it with any framework in iOS without Jailbreak ?
No its not possible. iOS does not allows application to manage device with it self. Application should work in the pre given area which is called Sandbox. So its not possible to handle the entire device and you can not check it that who is using the device.
This is not possible, you should look to Mobile Device Management solutions and rather go that route. You could also look at apple's business solutions.

Track other app from my app - iOS

Is there any provision to track(usage time) of any app from another app in iOS?For example:- I have developed an app named "A" and I want to track usage time of another app installed in my device(iPhone or Android) named "B". By usage time, I mean how much time a user had used the app. Would it be possible?
Another scenario:- Is it possible to track usage time of native app(like mail, camera, message,etc) from our app?
I think this is not possible in iOS, but not sure about it. Does anyone have any idea of this?Note:- I don't want to track my app usage using Google analytics.
You can't!
All the application in iOS runs in sandbox mode.
If you want to track your application usage you have to connect it to the server with (ex) REST interface.
EDIT:
Just bump on the idea...
If you writing for iOS7 you can use Shared Keychain feature. You can send there all usage statistics and receiving it by other app. Should work!
Check this out: http://shaune.com.au/ios-keychain-sharing-data-between-apps/
If both apps are signed by the same App Store Developer account, then they can both share an iCloud data store. Just store the usage time in iCloud and it'll work perfectly.
You cannot track any app by any other developer, the security model does not allow it.

Can I do an app like Find my iphone in iOS?

I want to create an app which has the following features.
Track friends / family members location
Locate/track the stolen device location
Lock the device, delete the device datas by using desktop or by SMS.
Most of the above features are provided by Apple's "Find my iPhone" app. But I just want to know whether is it possible to create such an app.
From my understanding, Apple wont let the developers to use private API's and they wont allow to erase datas (like Messages, Calls details) remotely.
Please suggest me some ideas.
If you create any app which directly competes with any of the apples build app will be rejected by appstore.. But most of the above things you can do with private api's and with the help of a web service..
It wasn't possible prior to iOS7. App was not able to respond to any remote calls. There is a new API which "can" be used to solve similar things: http://mobile.tutsplus.com/tutorials/iphone/ios-7-sdk-mutlitasking-enhancements/ or http://www.objc.io/issue-5/multitasking.html (Remote notifications). You may be able to track your friends or stolen device, but not to lock or erase it.
There is a way to remotely erase the iPhone without Apple's Find My iPhone - via Exchange account. There are some open source implementations of MS Exchange, so there may be a chance to make a service which would be able to wipe the device. But even when you make that service, there will be a need to add the "exchange account" into the iDevice. I am not aware of any function which can do so programmatically.
Anyway - You can do an app which is similar to Apple's apps, but it must be somehow different. It must provide some special content or functionality, otherwise it will be rejected.

iOS - Restricting use to single app

I am developing a business app for use on an iPad/iPod Touch. I am wondering if there is a way to restrict usage on the device to my app only. In other words, we don't want employees installing other apps such as games and playing around with the devices.
Yes, that's possible.
Check out the iOS Configuration Profile Programming Guide.
Edit: See the section about restrictions, it will allow you to do exactly what you need. Note however that you'll need to have access to those devices, ideally the devices should be company property. And you need to distribute your app via Enterprise Distribution.
Edit 2: Since iOS6, this feature is available through the normal settings app. It is called "Guided Access" and is part of the Accessibility settings. It will let you disable the home button (cancel guided access by triple-clicking the home button and enter the preset code) and it will even let you define areas within apps which should be disabled.
I don't think so, unless their device is jailbroken.
If they're logged into an Exchange server you could remote-wipe their phone if they install anything.
Do you provide the devices? Or they bring their own?
If you provide the devices that would mean you can use your Apple-id. If an employee would try to download any other app he would need the password of your Apple-id. So thats a simple way to prevent that.
Im am not sure if there is a total "lock" of such type.

Resources