iPhone how to override default settings programmatically - iphone

In iPhone, how to override default setting of vibrate and sound programmatically?

You cannot do that unless your doing it for a jailbroken device. Apple will not accept programmatically changing the phone settings. This is ultimately user preference.

I think You cannot(May be Possible if your application is run on a jailbroken device). Because there is no Apple API to access the iPhone settings. But you can Change the setting in your app Bundle.For Vibration You can Go with
#import <AudioToolbox/AudioServices.h>
and use
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
for Volume you can Go with
AVSystemController
[[AVSystemController sharedAVSystemController] setVolumeTo:10.0 forCategory:#"Ringtone"];
Try this SO Question
and the Best will be however use MPVolumeView (volume slider) is there to change device volume but only through user interaction.
MPVolumeView is a control in toolbox, you need to add MediaPlayer.framework in your project then MPVolumeView will be displayed in toolbox in interface builder.

Related

Is it possible to adjust level of vibration in iPhone?

Is there a way to adjust intensity/level of vibration in iPhone using iPhone SDK?
There is no way to adjust vibration, it either vibrates or it doesn't.
There is no way to adjust vibration. But, there is a way to access volume of iPhone.
MPVolumeView is used for that. One has to import MediaPlayer.framework for that.
Have a quick look here.

Is it possible to target both iphone & ipad using the same project?

The subject is self explanatory, I have a current iPhone project using Monotouch/MonoDevelop and I want to be able to target iPad too.
Is there any way that the application could do a "stretch"? I have not tested the app in an ipad, only in the emulator and it does not look good.
Thank,
Ignacio
Yes, you can. You can either programmatically check if app is running on ipad or on iphone and set different nib files for each mode.
Also you may use the same views either created programmatically or through Interface Builder, but in that case you should set your resizing masks properly.

iOS Multitasking Gestures - disable / enable

Does anyone know of any code to enable or mainly disable the Multitasking Gestures in iOS 4.3?
There is no public API to access or set this information.
I think the multitasking support is enabled/disabled from the Settings app, it doesn't look like there is support to change this setting programmatically.
You would probably access this via UIDevice* device = [UIDevice currentDevice];... but as you can see from the docs, there is no access to anything like this property.

How to make my app to support multitasking

i am developing an app for iphone and ipad with 4.0 as base SDK and 3.0 as target.
how to enable multitasking to this app.
thanks..
To adopt Multi-Tasking in your app. apply the following points:
Support all orientation from the target's General section in settings.
In the General section too. remove the check next to Requires full screen if any.
Select storyboard, click the File Inspector icon in the right side bar. check the box next to Use Size Classes. Check out tutorials how to use size class to adjust your views according to the screen size assigned to your app.
Refer http://answers.oreilly.com/topic/1867-how-to-update-your-iphone-app-for-multitasking-with-ios-4/
Also duplicate question how to do multitasking application in ios 4.0
If you build an iOS app using a 4.x SDK, Apple's "multitasking" will be enabled by default, unless you explicitly add a plist key to prevent it.
But multitasking may not work properly unless you add support for it in the app's resign/become active, and/or app's suspend/resume delegates.
If you actually want to run code in the background, then your app needs to be of a few very specific types, or add support for running some code for a very limited amount of time, for which you probably want to read Apple's documentation.

want to build an alarm app in iphone

I want to build an alarm application for iphone. I want to ignore iphone device state and volume buttons state. I want to play sound anyhow in full volume and also want that user cant modify volume using iphone hardware buttons while sound is played. Does anybody know how to implement it? Please post the code here.......
Thankx in Advance.......
This is not possible (without jailbreaking).
You cannot force the iPhone to change its volume or intercept the hardware buttons. Also you cannot "ignore device state", as you cannot run background apps. So if your app is not running you can't execute any code