Is there a way to programatically toggle vibrate? - objective-c

In objective-c for iOS dev, is there any way to programatically toggle the vibrate on/off? And also to check its current state?
If there is, where might I find it in documentation? I've looked and cannot find it so maybe it's not possible?
Edit: I don't mean to make the phone vibrate. What I mean is that when the phone is on silent there is a toggle to have vibration on/off. Can this be controlled programatically?

No you can't.
This is a system defined property (that your user can access from Settings).
None of the iOS APIs allow such kind of control.

Related

How to hide fullscreen apps in MacOS programmatically

I'm trying to make an app that would hide other windows/apps with a certain interval, but I'm stuck with hiding fullscreen app windows using NSWorkspace and NSRunningApplication classes.
Is there any way to exit fullscreen mode programmatically using public APIs? If not, what private APIs I need to look at to achieve this task?
Assuming you can get around sandboxing, you can use AppleScript to tell System Events to tell the process in question to set its attribute "AXFullScreen" of window 1 to false.

Siri on Custom keyboard App Extension iOS 8

Currently I am working on a iOS 8 custom keyboard extension and I want to mimic the functionality of Siri similar to the default keyboard.
Can we able to use Siri on iOS 8 Custom keyboard App extension? If we can is there any API/documentation available?
Thanks
Custom keyboard is an app extension, so it cannot access to the microphone. And without microphone, we cannot do something like Siri does.
I think we have to wait until Apple changes!
Custom keyboards, like all app extensions in iOS 8.0, have no access to the **device microphone**, so dictation input is not possible.
From: https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/Keyboard.html
No, native Siri access is not yet possible. You can use something like Nuance ndev to produce this functionality though. http://dragonmobile.nuancemobiledeveloper.com
You should be able to switch back and forth using the globe key so the user will have quick access to the native keyboard in the case they need to dictate.

How do you hide the menu bar in a Cocoa app?

How do you programmatically hide the menu bar in a cocoa app? I would like to make full use of the screen area.
There are two good ways I know of to do this.
1
In Cocoa, you can call the NSMenu class method setMenuBarVisible: to show or hide the menu bar.
As of this writing, the documentation for the NSMenu class does not tell you the following additional information.
The menu bar will only be hidden for the app that calls this method.
The Dock will also be hidden at the same time.
(This is true at least in 10.9 and I have not tested any other versions.)
This is useful when you want to use an app in a full screen way where you have a cover window, a borderless window the size of the screen.
The nice feature of this (as opposed to playing with LSUIElement settings) is that your app can continue to be in the application switcher cycling, as well as visible in the Dock when other apps are active.
This allows users to still activate a full screen app through the Dock or application switcher.
That means you can still use your app's Dock menu to access a preferences window for your app or other features.
This is incredibly convenient if your app is indeed a full screen cover window that runs at a window level higher than other apps, but you still want to make preferences and the ability to quit your app available, and you want your app's visual functionality available when other apps are active.
2
Another option is via NSApplication's method setPresentationOptions: with the arguments from NSApplicationPresentationOptions enum, such as option NSApplicationPresentationHideMenuBar
With this approach be very wary of reading the documentation, although it gives you additional options, and is still app-specific only, you need to know that some of the options are mutually exclusive. There are rules you must follow, or you get nothing but exceptions spewed to the console.
3 There is a 3rd and crappy option. If you have a helper app that is a daemon, you can use it to change your app's LSUIElement state and basically relaunch your app. It's dumb and it takes you out of the app switcher completely, which is great if you really are writing something that should not be there, but that is rare.
There is also the NSView enterFullScreenMode:withOptions: method, although most apps for which that would be appropriate prior to 10.7 should probably use the modern full-screen-window API on 10.7 and later.

Disabling Siri in an app

Is there any way to completely disable Siri within the app? I am not only talking about the proximity sensor, but the long-press on the home key as well.
Thanks.
No. It's impossible to override the functionality of the home button. In general, Apple does not allow you to modify the behavior of something that is outside of the scope of your app.

Is it possible to change global sound volume in iphone SDK?

Is it possible to change global sound volume from our app in iphone SDK?
If yes, how?
Thanks!
The only way you can do that is throught MPVolumeView. There is no such code to make it louder unless the user do it throught the standard component. I think the reason is way it is not only an input control but when you change the volume in the phisical button it is displayed back in the MPVolumeView too.