What "kernel level C function" does Frenzapp use to detect running iOS processes? - iphone

According to this iphonedevsdk.com forum post, Frenzapp uses two methods to detect other apps installed on an iOS device:
UIApplication canOpenUrl: to check
if known custom URL schemas can be
opened
A "kernel level C function",
that is "authorized by apple".
What "kernel level C function" are they using? Where is it documented?

Thanks to Vladamir and Stephen Darlington for commenting and pointing us at what is most likely the answer:
The kernel C function is sysctl()
It's documented on Apple's iOS Developer site
You need to call it with a certain set of arguments to get the list of running processes (ids and strings)
See Vladimir's previous answer or This post for example code

Right, though the process list is both very limited and presupposes that the process is indeed "running" in the background.
The key for discovery is having a large enough inventory of both process names (but the background tasking can only go so far...) and URLhandlers. And only a few companies in the World (if that many) outside of Apple can actually do this well.
And of course, the Springboard has an open-socket protocol that lets the App Store app (and potentially other apps) query whether an app is installed or not... but that's actually a much tougher one to crack.

Related

Disconnect from current internet connection in Swift 2

Is it possible to connect and disconnect to some available network connection with swift, cocoa?
///Addition
So.. I found the NSNetworkInterface, but can't understand how to turn it on or off. Need some little example, just explain, what call -> what get
Is it possible to connect and disconnect to some available network connection with swift, cocoa?
You can't do any of this on iOS, of course, since your code will never run with sufficient privileges and the necessary frameworks probably aren't available. You asked about Cocoa, though, not Cocoa Touch, so I'm presuming you're talking about MacOS X.
I assume that you mean actually connecting to a network rather than just connecting to some host over an established network. To do that, you need to change the system configuration. It is possible to do that, although you'll need to work at a lower level than Cocoa and instead use the SystemConfiguration framework to change the configuration registry. Your code will have to be running with root privileges in order to work, and that alone may make the process untenable depending on your situation. You can find complete instructions and code at Programmatically changing network configuration on OSX. Note that the article dates from 2011, so it's possible that things have changed enough that the advice there no longer works, but it will at least point you in the right direction.
The article obviously predates Swift, but I don't see anything there that wouldn't work in Swift.

"Do Not Disturb" feature in iOS 6 How to implement?

I want to implement the feature "DO Not Disturb" in iOS 6.
First question : Is there any framework or api apple exposed to control them through the code?
After lot of googling i found an application on the app store "Call Bliss" that provides this functionality and complete control over the calls, sms and mms.
Can anybody explain how this application works?
or
any other work around to learn and implement this feature in iOS?
Thanks in advance...
From reading the description of Call Bliss, it actually sounds quite simple in how it works.
1) Do Not Disturb must be enabled at all times. Not scheduled, not off, but on at all times.
2) It requires you to set the contacts group for exceptions to Do Not Disturb to "Bliss Exceptions". This implies that the application requires access to your address book.
From there, it's probably wise to assume that it manages the contacts in the "Bliss Exceptions" contact group based on whatever parameters you set in the application. It adds and removes people in that group based said parameters.
So to answer your question, no, there is no framework to do this. The way they're doing it is likely the only way to do it currently with no public API for managing do not disturb status.
There is no public API to even access do-not-disturb functionality.
I think this is what the app does:
The app creates and manages its own contact list (called Bliss exceptions)
the user have to select it in the do-not-disturb preferences.
The App can run in the background because it uses location tracking (probably significant only to save battery life), so when the user changes locations it can update the exception list.
When a call is received do-not-disturb system functionality checks the Bliss exceptions list and silences all calls from contacts on the list.
Please note that reviewers complain about the lack of time based call blocking. It is impossible because the app can only execute code when the location is changed.
In my Knowledge there is no way to implement it via code. There is no public api provided for restricting the calls.
But there is an API for detecting the calls : CTCallCenter and a FrameWork called CoreTelephonyFramework

Prefetching some data when the App is in the background

I know quite a few questions have been asked around this topic; however, am penning this as they don't seem to specifically answer my question, & some don't have any correct answer listed.
What I want to do in my iPhone App
Fetch some data when the App is not running (basically, it's a prefetch, so as to quicken it when the user uses the App the next time). What's the best way to do this?
Some Potential Solutions
Those that I could think of & some from Stackoverflow & such resources:
Possibility 1 : Fetch the data at a specific time of the day (maybe after midnight ?). Am not seeing 'clearly' how to do this if this this possible in the first place. Some suggest using a NSTimer -> but the timer is put off when the application is suspended, right?
Possibility 2 : Using local notification (?) But I see that Apple's documentation specifically mentioning that notification is to be used to convey something to the user & so this would defy Apple's doc then, right?
Possibility 3 : Through applicationDidEnterBackground -> beginBackgroundTaskWithExpirationHandler . This wouldn't run the fetch at a specific time of the day though. However, it might serve its purpose of 'pre'-fetching. Is this better than the other two?
Any thoughts please?
as you already know that none of the option you have presented are not going to work with ios and user can always close the background applications anyway so I would suggest that it'd be a good idea to fetch the data for next calendar day whenever the app is running.
As samfisher is saying none of your specs. fit with the Apple active background requirements. The only thing that I can suggest you is to use the beginBackgroundTaskWithExpirationHandler I understand that is a "post fetching" instead of prefetching but I guess is the only way.
The other way, but is a little bit trickier, is masquerade your prefetching with some sort of geolocation, in this way you could opt for an active background. This involve a lot of aspects such as:
Appstore rejection
Battery consumption
There are plenty of app on the appstore that use this trick, I can remember one that calculate data traffic.

Wake app at regular intervals while using UIBackgroundModes=location

I'm developing a navigation app which uses the UIBackgroundModes=location setting and receives CLLocationManager updates via didUpdateToLocation. That works fine.
The problem is that the intervals between location updates are very hard to predict and I need to make sure the app is called something like once every few seconds to do some other (tiny) amounts of work even if the location did not change significantly.
Can I do that? Am I allowed to do that? And how can I do that?
I found a blog post, but I'm not sure if this is really the way to proceed.
Permissible background operations are pretty limited in scope. You cannot, for example, just leave an NSTimer running to perform some arbitrary code while your application is in the background - so the simple answer to your question is no, you cannot. Definitely read the Apple documentation regarding what is and isn't allowed (most of what's allowed pertains to apps that "need" specific ongoing services, like the ability to play music, or respond to location changes (GPS type apps...). You may be able to construct a viable solution by responding to location or significant location change notifications...

OpenFeint achievements performance

I've decided to integrate OpenFeint into my new game to have achievements and leaderboards.
The game is dynamic and I would like user to be rewarded immediately for some successful results, but as it seems for me, OpenFeint's achievements are a bit sluggish and it shows visual notification only when it receives confirmation from the server.
Is it possible to change something in settings or hack it a little bit to show notification immediately as soon as it checks only local database if the achievement has not been unlocked it?
Not sure if this relates to the Android version of the SDK (which seems even slower), but we couldn't figure out how to make it faster. It was so unacceptably slow that we started developing our own framework that fixes most of open feint's shortcomings and then some. Check out Swarm, it might fit your needs better.
There are several things you can do to more tightly control the timing of these notifications. I'll explain one approach and you can use this as a starting point to explore further on your own. These suggestions apply specifically to iOS apps. One caveat is that these suggestions refer to internal APIs in OFSDK 2.8 for iOS and not ordinarily recommended for high level use and subject to change in future versions.
The first thing I recommend is that you build the sample app with your own product key. Use the standard sample app to experiment before applying the result to your own code.
You are going to get the snappiest response by separating the notification pop-up UI from the process of submitting the achievement. This way you don't have to worry about getting wrapped up in the logic for deciding whether the submission is going just to the local db or is doing the full confirmation on an async network transaction.
See the declaration of "showAchievementNotice" in "OFNotification.h". Performing a search in the sample app, you will see that this is the internal API used for displaying the achievement pop-up when an achievement is earned. It does not actually submit the achievement. You can call this method directly as it is called from "OFAchievementService.mm" to directly control when the message appears. You can then use the following article to disable the pop-up from being called when the actual submission occurs:
http://support.openfeint.com/dev/notification-pop-ups-in-ios/
This gives you complete freedom to call the submission at a later time provided you keep track of the need to do so. For example, you could locally serialize a flag to take care of the actual submission either after the level is done or the next time the app starts up. Don't forget that the user could quit out of a game without cleanly finishing a level.