Extracting screen time usage of the user in an Ios app (maybe with the Screen Time API) - ios

Dear StackOverFlow Friends,
We are having a hard time understanding a concept that relates to the app idea that we are planning to develop. Imagine that we have an app called A. that requires the user's screen time usage information for selected apps like Udemy, Duolingo, and such. Our concept does not require any kind of app tracking or anything else, the only information that we need to acquire is the screen time information of the user. Accordingly, we have found an API namely Screen Time API, however, within the documentations and open topics, we couldn’t exactly be sure that we would be allowed to have such information. In this sense, we will need your kind support directing us around the idea and API.
The app will provide a futuristic, ToDo, and agile-oriented device usage environment for users to track their daily objectives by directly using the screen time information (of the apps, not just the overall phone usage).
Are we able to extract Screen Time information of the user's various apps?
Are we able to use the Screen Time API, no questions asked?
Do we need to create a proposal for the AppStore team that elaborates our idea for the App publishment?
Regards.

Related

Use Analytics in a WebView on Android and iOS

I am writing to you for the first time. I would like to know if with the "webview" configuration (https://firebase.google.com/docs/analytics/android/webview), it's good for hybrid apps and if you can track the transactions carried out on the institutional site, more precisely the payment takes place on the site and not within the app and understand that users who have converted arrive from the app and not from other channels. Thank you in advance for your opinion.
Elisa

How do social networking apps update their UI in real-time?

I was wondering how social networking apps, such as Twitter, Facebook and WhatsApp update their user interface in real-time when another user interacts with the user of the app. To use the best example I can think of: when you have a chat window open in WhatsApp, the UI updates automatically (without any user actions required) when the user you're chatting with interacts with you. Messages appear on your screen without refreshing and the "last seen" status at the top of the screen updates automatically when your chat partner either goes offline or comes back online. I can think of two ways to achieve this:
Remote push notifications: this approach strikes me as the 'cleanest' way to do this, but it's probably also the riskiest way. Using silent notifications (content-available) to pass data to another device at the moment a user does something, would probably save you a lot of HTTP requests and therefore would make your app consume a lot less data and CPU usage. The risk of this approach is that a user can easily disable ALL push notifications to save battery power (including silent notifications) and then your app wouldn't be able to get notified on events remotely.
Local UI refreshing: This approach is obviously the safest, but I think it's really 'nasty' and eventually everyone would feel the downside of it. Constantly refreshing the UI and re-retrieving data from the database to make sure the latest messages and statuses are displayed to the user would be safe in the way that your app doesn't have to rely on the device's battery and background mode settings, but the downside is that this will make your app consume a lot of data and battery power, which would be bad for the user's data plan and his device. I also don't think Apple would approve of an app that's consuming so much data and power.
I've just implemented a chat function into my own app, and I want to enable the same real-time UI updating that WhatsApp uses. What would be the best way to do this? Should I use one of the two methods above or can someone think of another way to do this? By the way, I'm a relatively new programmer who just recently learned how to develop iOS apps (Swift). I'm very far from being a pro, so please go easy on the explanations and work method capabilities. Thanks!
The chat apps make use of WebSockets to create a constant connection with the client and a backend server.
This article on Appcoda can help you start learning about Socket.io. It answers your questions and also helps you to create a demo app.

(Swift) Get usage data from other apps through the battery page in settings

I am trying to make an app where it tracks the usage of other apps. I already know that this is impossible to do by directly getting usage data from apps that do not belong to you. I am wondering if there is any way to access the battery page in the settings app by using the code in swift.
All I want is to be able to read the data for hours used and use that data in my app. I know this is probably a stretch, but is there any possible way of doing this?
There is no API to read this data directly.
There is an app on the App Store which has a hacky workaround. It requires users to take a screenshot of the battery usage settings page. The app grabs this photo from the user's photo library and uploads it to their servers where it is processed (using image analysis and OCR). They use this information to estimate how much each app is used.

How do I deal with save game data when changing Apple ID on ios device

This comes close to an opinion question, but I hope that someone can give a definitive answer.
I have written a game app and I save game data locally. But I also will want it to be cloud capable and I am currently writing the code but I keep hitting a mental barrier. In several places in the iCloud and Game Center documentation it says if I change Apple ID, I need to delete the local save game data/file cache. This is contrary to how my app currently works, which is OK if I can figure out the right way to do it. In the ICloud documentation it says to either user the cloud or don't use the cloud and only ask once, but there is a button in the settings to turn the iCloud Drive on and off.
The core of my dilemma seems to be that an IOS device is not tightly linked to one Apple ID. I understand that multiple devices can be associated with one Apple ID, but not why it should be true the other way around.
This can be seen as either added capability or enough rope to hang oneself. As a user I can, using my Apple ID, get on to another device not associated with my Apple ID and:
download an App/Song
log into Game Center and play a game we both own.
etc.
I know Apple deals with this and now I have to do the same.
As App Developer I see a world of questions about what this might mean, like "Well I'll do this or that but what do I do the first time this other thing happens?", etc.
For example, initially I thought I could consider "local" store the same as a very long airplane mode, and when the cloud became available I could sync the delta to the cloud and across devices, but this does not address changing Apple ID. Do I blow away the local data, keep the new user from playing the game, only allow local or cloud but not both?
Now Apple is adding Multitasking, and a login to iPad's used in schools, the problems become even worse.
I keep trying to find some profundity that will steer me to the correct answer but I am at a loss on how to deal with Apple ID changes.

How to detect data being per app basis on iOS

I recently came across an app in the app store called Dataman Pro. It has a feature that lets you see the data usage per app basis (see the attached screenshot). I have been wondering what is it doing to get this sort of information.
See this post about getting the list of installed apps, and this git project.
Then about usage tracking:
If you wondered about any public APIs that give you network statistics out of the box - there's nothing there.
DataMan it self is an app that used to work in the background all the time, and bind to the network interfaces to track network usage. Which is one of the reasons that its data is never 100% accurate as it is not guaranteed to always work in the background. This is also the reason Apple kicked it from the AppStore after a few versions...
Now that app has returned, if I understand correctly, after making a few changes: Mainly avoiding "hacks" to stay in background, and using Location Services to get back online when the user moves around. I guess this is another hack but one that Apple did not oppose to, yet.
Edit:
After looking around the web for a bit, it seems that Apple found that trick also, and removed many apps from the AppStore due to staying in the background by using location. I guess right now it's not working more than 10 minutes in the background, so you open it when you want to measure current Activity, and it stops measuring after 10 minutes.
About the tracking code itself, its mainly C code, using CFNetwork framework, and you can find some answers on stackoverflow on this subject.
More, in response to comment:
Well, the part about seeing the installed apps list, and foreground app, is not exactly private APIs, but private plist, as you mentioned.
Apps which access private files do get through from time to time. When Apple finds that some "private" files are accessed and need to be kept safer - they change it in an iOS update, like they did with the call history file, which is sensitive. Old apps tended to use (around iOS <= 3.3) the call history db to do some stats, and on iOS4 they were obsolete by the file moving to a secure location.
Reading "private" files which are unprotected is pretty easy to do without getting caught by automatic analyzers.
When you know which is the foreground app, and you can count current network usage, you can associate it with the app... And get an estimation. So this is how they do it, most likely.
However, The techniques change from time to time, due to Apple re-reviewing apps and their own policies, and due to API changes, and if you track the history of such apps and even this specific app - you will see that from time to time they get kicked off of the AppStore and return with a twist. They adjust... So no technique is reliable and this is a major headache to maintain, which is probably why the developer charges 9.99$ for it. I would.

Resources