iPhone locked in portrait mode - iphone

My question is similar to this thread
which says to lock the iPhone in portrait mode and doesnot allow it to go to landscape mode.
This can be done easily but my concern is I want to lock all the applications running to the portrait mode in iOS 4.
That is if I have locked the orientation mode and has minimised my application then the none of the application in iPhone shall go to landscape mode.
So my question is
Is it possible
if yes then how? Any ideas or link will be really appreciated.
Edit: I know this is already available in iOs 4.0 but its hard to find also this is just for information purpose.
For those who disagree: check out the link
Thanks in advance...
Edit: Finally as per everyones suggestion I think it is not at all possible to lock other applications orientation through our application.

How would you feel if any 3rd application is accesing the orientation of your application and that of device.
So Its all handled out by Apple itself. Also as told no application is allowed to effect the system variable..
So in case you succeed in finding out the hack for this thing... Then also your application is gonna rejected by apple...
Still all the best for ur research :P

Sorry, but you can't lock the orientation via public APIs, and if you are going to use private APIs, Apple will never approve your app.

An iPhone app cant affect system wide variables such as screen lock. If you could, then there would be nothing keeping you from accessing all the other data on the device as well. Sorry, but if you want your app approved by Apple, you'll have to give up on this feature.

Related

Can I programmatically lock my iphone screen?

I am working on a jailbroken iphone and I don't care if Apple rejects this app.
I am not talking about the simple keypad lock that can be achieved through
GSEventLockDevice();
I am talking about a passcode lock or some way to get the iphone stuck or to disable the home button?
Is it possible programmatically?
It's called kiosk mode or guided mode.
Here are couple of articles generally describing this subject:
http://joris.kluivers.nl/blog/2012/03/02/kiosk-mode-for-ios/
http://www.idownloadblog.com/2012/06/26/ios-6-guided-access/
Here is stackoverflow question with several approaches:
Lock-down iPhone/iPod/iPad so it can only run one app
And here is one more approach:
https://blog.compeople.eu/apps/?p=275

link iPhone control app to main iPad app

Does anyone know what might be the best way to go about doing this? My CS research prof. suggested that Bluetooth might be the best way to go.
I am working on a music app for iPad and want to make a separate app on an iPhone/iPod touch to act as a remote control for the main app. Just sending a few button/slider/etc messages to a few IBActions.
Thanks.
This is the right approach.
Refer to the CoreBluetooth Framework Reference for all the necessary information.
There is also sample code.

Device auto-lock

I have an application in which I want to lock the iPhone programmatically so that the user can't perform any action.
How can I determine the user is not working with the iPhone for some period, and after that period automatically lock the phone?
Such applications are used in all phone devices, where the user can set an auto-lock time and then the device will automatically lock if the user does not handle the device.
How is it done programmatically? Please give me one example of the code so I can perform this easily.
I am new to iPhone programming, and I am struggling in my application. Help me. Thanks in advance.
(For your lock the iphone device through programatic only )
Impossible.
But , you could prevent your phone from locking when your app is running.
[UIApplication sharedApplication].idleTimerDisabled = YES
There is no way to disable the Home Button in iOS using the documented API. The user will always be able to get back to the home screen or close your application using the Home Button.
Even if you find a way do it (which is very unlikely) your app will be definitely rejected from the App Store for a blatant violation of the iOS Human Interface Guidelines. If I were you I would reconsider implementing this behaviour, frankly, it's just not a good idea.
If you're only looking for blocking the the UI of your app, check out the answers to this question, more specifically, check out the incredibly useful MBProgressHUD library:

forbid exit from iphone/ipad application

is it possible and how to implement forbiden exit from application on iphone/ipad?
we have an application that must permanently work on ipad device. user should not have any way to exit from application. could you advise how to implement this functionality?
By jailbreaking it and installing custom software that enables you to do that.
Or putting a lot of tape over all the buttons.
Anyways, you can't do this with a standard app on a standard device. Just think about it - would be a pretty annoying thing for apps to do, wouldn't it?
Apple's own human interface design guidelines would forbid this. Your app can't encroach on the abilities of the OS that transcend your own application's responsibilities. The whole point is to have a consistent experience for the device and if you're modifying something as fundamental as switching apps, you're violating that principle.
If you can't exit the app, you're essentially turning your device into a single purpose unit. How do you expect to get back to the app list if you disable fast app switching and the home button?
Whatever solution you find would not be approved by the app store.
You should look at whether the current multitasking features can help chip away at your reasoning for needing the app to always run in the foreground.
If you are talking about an enterprise app locally distributed, you might be able to do this, though probably not.
The best idea would be to physically break or block the hardware button.
Or issue alerts to the device every 10 seconds making the thing effectively unusable when outside the application (you can ignore incoming notifications for you in-app).
Why do you have this requirement?
There is no way to implement this functionality. You cannot do it.
You can't do it, But if you jailbreak and configure the "Home-Button" settings you can :)
Btw, If you do it, the only way to quit will be a shutdown... And to shut down every time would be kinda annoying...

iphone screensaver (with clock)

Could I create an iPhone app that replaces/modifies the default clock screen saver and show something else instead (e.g. my own special clock or whatever)?
How do I go about doing that? I'd appreciate a link to a tutorial on the subject, or to example code that does something like this.
(disclaimer: total iPhone dev noob here)
It's not possible to override any of the functionality on the existing apps/features on the iPhone, including the screen that is shown when the phone is locked. You could write an app that mimicked that functionality when launched, but I don't think that's what you're looking to do.
I think this would be a violation of apples UI guidelines and there is a good chance it would not be accepted to the app store.