Programmatically detect which iOS application is visible to user - ios

I found this and the problem is that the answers on that question didn't pan out (I also tested them first) and also that it is over a year old.
I've used the solution here to fetch the list of all running processes, but not of the struct kinfo_proc attributes seem to give any useful in detecting which app is currently visible to the user.
Basically:
I am trying to find out which app is currently visible (and open) to the user on iOS devices.
It must work on stock devices (non-jailbroken) and no need to worry about the app store.
Edit: I am looking at the private APIs now, but cannot seem to determine how my app could be notified (or inquire) about a new application being brought to the front.
Thank you

Thanks to #JohnWoods in the comment section of the question, I was able to find the solution on a related question.
The solution I used and that worked for me was here.

Related

Extend existing independent WatchOS app with iOS app and share data between them

First of all, I'm a newby and I'm sorry if this question is already answered. I searched and I didn't found any similar.
I already have and independent WachOS app and works fine by itself. At firs I thought that with it alone will be enough but now I realized that with an equivalent iOS app I could reach more people. So now I'm wondering if it's possible to modify my Xcode project in order to add an iOS app with the same content and functionality as I have in the WatchOS app and both of them sharing the same data, that is, if I change a value in one of them, later I will see this value updated in the other one.
Thx in advance
If you already uploaded the app to the AppStore then I'm afraid it's not possible. Source: Reverting from an Independent Watch app, to one that is dependent on an iPhone app

List of Apple devices using the home indicator?

I'm developing a mobile app and need to know whether or not a home indicator is present on the device I am on (in ios cases). I know that it exists on iPhone X and higher versions. But I can't find out an official list of devices implementing that new feature. Is there one?
That way, I could adapt my UI design according to wether or not the device I detect belongs to that list. (using com.diamonddevgroup.device.Device API)
Just in case, I'm developping using codenameone.
Thanks
I added support for handling that.
Once the update has been approved by Codename One team, update your Device library and call below:
boolean isNotch = Device.isNotch();
You can check the GitHub page for the library here.
And you can follow the status of the library update approval with this pull request. It is approved once its status has changed to Closed.
Leave a comment on this answer or create an issue here if you encounter any problem with the library.
You should definitely be using the safe areas with auto layout to properly layout your views.
But in the case you want to do device specific work, this library is fantastic for knowing about your user's current device.

Listing all available WiFi access points in iOS

I am trying to build an iOS application where I'll show the user a list of available WiFi Access Points to the user. First of all, I know that trying to do this will get my Application auto-denied in the App Store and that's okay, I'm only doing this for research purposes.
While I was researching, I found this GitHub library but it only works for 4.x and 5.x. This topic was also discussed in this question on how to use the iphone-wireless library but the top answer's link is down. Another answer linked this GitHub repo with a sample project but it seems that it only scans for other devices connected to where your device is currently connected.
I also found iPhone-Wireless' Google Code page but there's no guide whatsoever on how to use it.
Has anyone done this before? Listing all the available WiFi Access Points? I am okay with using libraries that will make the App Store reject my application as I have to plans of distributing it.

Detect which app is in foreground on iOS9 without jailbreak

I'm trying to log users individual app usage on iOS9.
I'd rather prefer that it wouldn't use jailbreak limited solutions, self explanatory. Doing the variation of this app on a jailbroken phone shouldn't be hard.
This will certainly not be released on the App Store as Apple wouldn't allow it.
I'm looking for any private API that can do this, any hidden iOS API's that can be used to do this. ANYTHING.
What I've already looked through:
how to determine which apps are background and which app is foreground on iOS by application id
How to know about app launched and details jailbreak iOS 7
Is there a private API to be able to detect what is current foreground app on iOS?
How to monitoring App running in the foreground in iOS8?use the PrivateFrameworks SpringBoardServices
which proved to be relatively helpful - we now can assume that there is some sort of additional access requirement, probably an entitlement, but we don't really know how it should look like
Can you find individual app usage duration using SpringBoard services framework or other private framework?
Find out active application or if on Springboard
Programmatically detect which iOS application is visible to user
However all of these proved to be unhelpful because Apple fixed this security flaw with iOS8 and the method to copy/access the currently front most app bundle identifier no longer works.
Question is: Is there someone who knows a workaround using different tools/exploits that do not require jailbreak?
Ideas:
inspecting the processes running on the device and devising an algorithm that would be able to recognize spikes that mean an app has been launched, which potentially could work, but it probably would be a major pain in the ass. Questions mentioning this solution:
Detect which app is currently running on iOS using sysctl,
Return a list of running background apps/processes in iOS
How to get Names of Background Running Apps
Find Background running apps in iphone
inspecting the phones traffic somehow?
not sure if there is some kernel stuff that I could do
Here is my Reddit version of this question if anyone wants to check it out. Also if it's of any value, here are the runtime headers for iOS9 and list of Apple's private API's.
Unfortunately, I was looking for a similar solution and have come to the conclusion that, at least at this point in time, there are no known methods that will allow you to determine app usage on iOS. Even the MDM providers such as Good, Airwatch, MobileIron, etc. don't seem to be able to do this. If anyone is able to come up with a solution, I'd love to see it.
For now, however, I think we would have seen a solution if someone had one that worked on the latest iOS.
sysctl is still open but they block certain combinations of selectors. I did this on iOS 7 and gave Apple Product Security the code. They won't patch iOS 7 but rely on App Review. iPhone 4 is wide open.

iOS7 Screen Capture Prevention / Detection

In my iOS app I need either prevent the screenshot capture (by pressing combination of Home +Power button), or need to detect before it saved to the Photo library .
In previous iOS version before taking screenshot touchesCancelled:withEvent this method will called , but iOS7 onwards this wont work.
Apple provide a notification
UIApplicationUserDidTakeScreenshotNotification
for detecting screenshot capture .The real problem is this will fire only after the screenshot is saved in Photo library .
Is there any methods (Private /Public) for detecting screenshot before it happens , or Just prevent the screenshot feature .
Dont consider it as a duplicate question , it is iOS7 specific question
No, nothing has changed since iOS7 and it will not change in the future, it is a conceptual issue, iOS app doesn't has control over the device public functions, consider you turned off 'taking screenshot' while other application needs it!! How this app would know about that?
Best thing you can do is using Configuration Profile as mentioned #QED valid answer.
You can restrict with a Configuration Profile, as described in the linked question.
Check out the Restrictions Payload section, starting on page 27, of the iPhone Configuration Proifile Reference. The key you want is allowScreenShot, described at the bottom of page 30.
Also, the linked reference states that there are a number of ways to install a profile. It may be possible for you to provide, within the app, some method for the user to trigger your server to install/reinstall your profile. Just a thought, I'm not experienced in the matter.
I'm not able to speak to private APIs. You might check out http://www.modmyi.com, or snoop around on IRC for some jailbreak communities. There are lots of experts out there who may be able to point you to the API, but they don't tend to hang on SO.
Good luck!

Resources