Is it possible for an app to run in the background and collect data? - iphone

I want to make an app that runs in the background so that if a user is reading a web page or PDF file on an iPhone or iPad, he can mark some words, see the meaning of those words, and then have those words stored in the app's database. He can then afterwards look for the words which he has learnt and increase his vocabulary.
Does the iOS 4 API allow that? What are the limitations? Advantages? Disadvantages?
Thanks in advance

No is does not, you can only run voip. audio or navigation apps in the background.

Only one app can run at a time, and installing one app cannot effect any built in app. So no, there is no way to achieve what you are trying for here.
Your best bet is to instruct users to copy the word, open the app, and then you can snag whatever is on the clipboard then.
(Note there are multitasking APIs, but you still cant access anything outside of your app even if you convince the OS to let you run in the background for a little while)

Related

Is it possible for one app to check for how long any other app was running on iphone/ipad?

I want to monitor for how long the apps were being run in the foreground and want to keep some statistics.
Lets assume that I have Apps A,B,C,D on my iphone/ipad and I install one more app "MyMonitoringApp" I want to get the details about how long A,B,C,D were used or run in the foreground from MyMonitoringApp and want to take some action if they exceed certain limit. Is there a way to do this programatically?
Thanks in Advance.
This is simply not possible. At most, you can check if another app is installed if you know its URL Scheme. Anything more than that is not possible.

Open an application from a background app in iOS?

I have an application that runs in the background, I need it to pseudo randomly take a picture using the forward facing camera and send that to a database.
A possible solution I thought of was to use URL schemes to open another application, which will take the picture and send it, then use another URL scheme to open the background application back up. Does anyone know if this is possible?
Or perhaps there is a better solution.
It is not possible for an iOS application in the background to initialize, utilize, or grab photos from the camera hardware, let alone store or upload them to a local database.
Not only is this a security risk, but it poses a potential privacy invasion, and is just plain creepy. Besides, background apps only stay alive for 10 minutes or so, so even if this activity were possible, sustaining it would be impossible.
However, it is possible to use the camera directly from an active app without having to delegate the task to another application (perhaps you are thinking a little too much like an Android developer :p). Take a look at UIImagePickerController.
There's a very limited set of actions background applications can do—GPS, audio, phone & VOIP calls, and a couple of others. Accessing the camera is not one of those allowed actions, so you can't take a picture in the background.
As an alternative, you could set up a notification system to alert the user that it's time to take a picture (for whatever reason), and if they choose to open the app it could do your required actions then.

passworded exit from the app

I am developing an iPhone app, that will not be distributed on AppStores. I have tried to search for private api but no luck. When the user tries to quit the app, I want to prompt the user to enter the correct password so as to enable him to exit the app. How can I achieve this? Thanks in advance.
Cheers!!
It sounds like you need something similar to iOS "Kiosk Mode" as described in this answer:
Put an iPhone or iPad into 'Store Demo' mode
Using that description in conjunction with the following steps might achieve precisely what you want:
Have a "Quit" button
Show a password dialogue when it is pressed
If it was correct, read an out of bounds array location (or do whatever) to crash the app
With that config installed you'd get stuck in whatever app you launch next, though.
You can't! You'll have to password protect the launch instead.
If you want to prevent the user from quitting your app, you'll need to physically cover the home button. This isn't a bad solution if your goal is to do something like a kiosk or a point of sale system, where you probably want to mount an iPad in a secure enclosure to prevent tampering or theft anyway. There are quite a few such enclosures on the market in a variety of styles.
For a normal app, though, there's really no solution -- iOS isn't designed for whatever you're trying to do.
The only way I could think to do what you want (which is to prevent access to certain apps) would be to replace the SpringBoard application (this is the method used by Apple itself in the App store models of the iPhone and iPad that restrict the things you can do on the devices). #owenfi pointed at one way to do that without jailbreaking, but in general it is limited: you won't be able to "exit" the app, you will basically just be able to run a single app.

How to find the application launch and end time in iphone?

I am new to ios development and doing development in ios4.0.1 and xcode 3.2.3. My application should capture other application's launch time and (close) end time. how can we do this? Any help will be appreciated.
Thanks
Pushpa
For apps in the app store, the answer is "You can't". The best way to think of other applications on iOS with respect to yours is: don't. You can't access their data, you can't see if they're running, you can't control them, and you can't change them. Apps are well and truly sand-boxed as a fundamental design decision in the current setup.
About the only thing you can do is trigger their launch with a suitably formatted system URL. If a Wikipedia application has registered the scheme wiki, you might be able to launch and communicate some simple data by having the system load the URL wiki://articleName, but that's the limit. You don't even know what application will be launched, only that one has the wiki handler.
Jail-broken iOS systems are a whole different matter, but I'm assuming you're not working on those.

Can I run multiple app in iphone simultaneously

I want to run two app simultaneously, I am using jailbroken phone and dont want to upload that app to the app store.
Is there any way so that I can log phone call time, this can only be done if my "logging app" is running in background.
Please suggest me, how can I do this on jailbroken phone.
Some thing like:http://msdn.microsoft.com/en-us/library/ms884959.aspx (its for windows)
Is this actually a programming question, or are you asking for an app that logs call times?
Assuming the former, you would write a iPhone program that hooks into current phone conversations some way (private APIs? Not sure if this is indeed possible, just assuming.) You would then run your app via Backgrounder or some other wrapper that provided an interface for multiple applications to run at the same time. This usually comes at the cost of increase battery life, depending on how much CPU (and maybe memory?) the backgrounded app consumes.
Backgrounder is available via Cydia, I believe.
Need to include CoreTelephony, will solve the issue