Continue to read iPhone accelerometer data while screen is locked (manually) - iphone

I know this issue has been discussed before as in: Enable iPhone accelerometer while screen is locked
I tried the solution mentioned in the post, including adding the DeepSleepPreventer module, as well as enabling proximity sensor as suggested in the answer Enable iPhone accelerometer while screen is locked by adding:
UIDevice *device = [UIDevice currentDevice];
device.proximityMonitoringEnabled = YES;
However, as soon as I manually lock the screen on my iPhone touch, the accelerometer stops sending data. I'm using iOS SDK 4.3. Did I miss anything? Any help would be greatly appreciated.

It's impossible to get accelerometer events on locked ios devices via SDK

Related

Get vertical rotation iphone

I'm developing an app in which I'm getting iPhone's movements.
The iPhone should be taken vertically while the app is running, then I've implemented the accelerometer which helps me to analyze inclination, but I can't study the rotation with it.
So I need to analyze magnetometer rotation, but I don't know if I can use it also if I have the iPhone vertically.
Has anybody already implemented some code for this use?
Thanks!
if (UIInterfaceOrientationIsPortrait([[UIDevice currentDevice] orientation])) {
// device is currently in portrait (vertical) orientation
}
Also, possible duplicate of this : Detect verticality of iPhone

how to detect mic position on iPhone?

iPhone 4 has a mic on bottom-left, iPhone 3GS and earlier had a mic on bottom-right.
How can I detect where is the mic on iPhone? What function does that?
You will have to detect the specific model of device (e.g. "iPhone2,1", etc.) and do a table look-up from information you determine. And to future-proof the result, you may also have to have it look up the position of the mic from your web site, where you can keep a table updated with device types as Apple introduces new ones.
I would not use the method as said in the comment to your post. The minute the new iPad or iPod Touch is released with a front facing camera, your application is off.
Why not just use a method like in this post: Determine device (iPhone, iPod Touch) with iPhone SDK
The code (if you scroll a bit down) shows how to detect which version of iPod/iPhone/etc is running on.

Multitasking with iPhone 3G?

I'm a bit confused about multitasking. I have a timer app which I am updating for OS4. Previously you had to keep the app running for the timer to sound, I have now modified it using a LocalNotification so that is the user exits the app then they get an alert when the alarm fires. I've tested this on an iPhone 4 and all is good, it works as I expected.
I then tried it on an iPhone 3G with OS4 installed. Now I thought that multitasking wasn't supported but my alert still pops up if the user has exited the app. Does this mean that multitasking isn't supported but local notifications are? I don't really want this as it causes several problems. When I click view on the alert it just relaunches the app, it doesn't take you to the alarm screen. More importantly you can't cancel this alert and could potentially set up lots of notifications which would be annoying and confusing.
Can someone clarify that my thoughts are correct? Basically I guess I want to know how to get around this. Is there something I can do to check if multitasking is supported so I can only set the notification if it is?? A clue of what to search for would do...Thanks
Multitasking and Local Notification are two different things.
Local notifications are supported on every device running iOS4.
In order to know if the device support multitasking or not you can use that
UIDevice* device = [UIDevice currentDevice];
backgroundSupported = NO;
if ([device respondsToSelector:#selector(isMultitaskingSupported)])
backgroundSupported = [device isMultitaskingSupported];

Multitasking on iOS4: Does it work only on iPhones?

I have iOS 4.0 on an iPod Touch 2nd Gen.
There's absolutely no multitasking working. Nothing goes to the background, and double-tapping the Home Button results in just nothing. I wanted to test my app against this new feature, but it appears that it doesn't work for iPod Touch devices?
Does that only work on the iPhone? Or is there some minor upgrade like 4.0.0.1 that enabled multitasking? Or must I enable that somewhere, manually?
Really strange. I do the exact same thing like the Apple guys do in the demo videos.
The documentation says:
The ability to run background tasks is not supported on all iPhone OS–based devices. If a device is not running iPhone OS 4 and later, or if the hardware is not capable of running applications in the background, the system reverts to the previously defined behavior for handling applications.
You can test if it's supported with the following code:
UIDevice * device = [ UIDevice currentDevice ];
BOOL backgroundSupported = NO;
if( [ device respondsToSelector: #selector( isMultitaskingSupported ) ] )
{
backgroundSupported = device.multitaskingSupported;
}
Multitasking only works on the 3GS iPhones and up. You are out of luck with your 2nd Gen iPod Touch (its like the iPhone 3G, sort of). Sorry.
EDIT: You would need a 3rd Gen iPod Touch, just to be clear.
You need a 3rd gen iPod Touch for that to work. I've run into the same issue.
According to this wikipedia article (see features section) multitasking is supported on 3rd gen iPods only
Apple's official ipsw's (iphone software) have disabled multitasking for ipt2g. If you jailbreak you can enable multitasking for your device but the performance will be poor.
Mutitasking is supported by 3 generation n 4g ... Iphones
I believe UILocalNotifications, part of the multitasking package, are supported on the 2G iPod Touch and the iPhone 3G.

iphone: Sending multitouch from the device to the simulator?

I need to record a video of a multitouch game I'm working on, and I'd like to record it from the simulator. My idea was to send touches from the device to the simulator (like this project does with the accelerometer). Just by googling I haven't found anything like that, but before I start implementing it I thought I'd ask here if anyone knows about an already existing solution.
Just to be clear, I do need full multitouch (up to 5 fingers). The pinch and drag that are available on the simulator are not enough.
Matt Gallagher has a writeup on synthesizing touch events, which might provide what you're looking for, although I've not tested it myself.
Check out iSimulate, it is an application/library pair that allows you to use to multi-touch (up to 5 fingers), the accelerometer, and the GPS in the iPhone Simulator. It takes only few minutes to integrate into your iPhone project.