Recognize the Host App in an iOS8 Custom Keyboard - ios8

How do I recognize in which host app my keyboard is running?
Basically, I want to change some things in my custom keyboard in specific apps
Maybe I can customize the keyboard traits to my use?
Thanks

This is not possible unless it is one of your own app, or you have some kind of collaboration with the running app.
A custom keyboard and a running app can communicate with Darwin notification. The running apps needs to broadcast the darwin notification, and keyboard needs to observe that. So if the developer is not already broadcasting it, then you can't identify it.

Related

Skipping confirmation popup or overriding for Bluetooth Device pair in windows from UWP app?

While connecting to any Bluetooth device, a yes/no popup appears from windows.
From app, is there any way to programmatically skip this yes/no popup?
Checked few documentation.
After talking with some Bluetooth guys, it seems that you need to use custom pairing in your scenario. This feature enables creating your own user interface to interact with the user as needed.
The sample code you could refer here:https://github.com/microsoft/Windows-universal-samples/blob/main/Samples/DeviceEnumerationAndPairing/cs/Scenario9_CustomPairDevice.xaml.cs

Can we disable user interactions with other applications in mac while our app is running?

I am working on a mac based application and need guidance on one of the features, what I am trying to do here is
When my app launches I don't want the user to interact with any other application unless the user hits the close button of the app. No keyboard shortcuts should be enabled for mac like cmd+spacebar etc.
My question is if this is doable? Is there official documentation from apple which says it won't allow doing this due to some technical reason?
macOS has supported "kiosk mode" since 10.6; it allows your application to:
Hide / deactivate the dock, menu bar and Apple menu
Disable switching and hiding of your application
Prevent restarting or shutting down the computer
Broadly,NSApplication exposes a bitmask property, NSApplicationPresentationOptions, that lets you select the combination of settings you want to use.
The best resource to read further is the archived documentation that #KenThomases located here and here.

TTrayIcon for MacOS?

In Windows VCL, I have the TTrayIcon to be able to (partially) hide my application. Is there a similar method to have an application being outside the normal task list on MacOS and only accessible in an alternate location normally reserved for background applications?
The specifics is a TCP/IP server listening on a port for incoming traffic, but one that doesn't need a UI interface (except for setup purposes). On Windows, I manage this with TTrayIcon and a TPopupMenu, but I am at a loss on how to implement similar functionality on MacOS.
What you are looking for is called Menu Bar app for Mac OSX. A search for "macos menu bar app source code" will yield lots of examples, but I have only found one (partial?) example written in Delphi. The main API to use is NSStatusItem.
EDIT: There is an example statusitem.pas for Lazarus / Free Pascal which might be useful for your purposes.

Should i use Growl on a mac app?

I design an app for mac (new in cocoa) and i need to use a notification on monitor. I was going to implement growl. But i see that growl now is not free at App Store. So i wondered if it will still be the default notification manager on macs.
So do you think that i should use Growl for my screen notifications? If not any other suggestions?
It's not free, however you can download a standalone Growl library that allows your app to show Growl notifications without actually having to install Growl on the user's Mac.
Please refer to Growl's website for more info.
With that said, yes, using growl is recommended due to the familiarity it enjoys. If you are gonna support Mac OS X 10.8+, however, I'd say just use the new Notification Center.

OSX Carbon: Quartz event taps to get keyboard input

I want to get Keyboard Input on OSX using c++ without using Cocoa, deprecated Carbon UPP handlers and if possible without using IOHID since that's alot of extra work.
I allready implemented a simple mouse class using quartz event taps and it works like a charm and now I'd like to use them to implement a keyboard class. Anyways as the reference states under CGEventTapCreate:
http://developer.apple.com/library/mac/#documentation/Carbon/Reference/QuartzEventServicesRef/Reference/reference.html
you can only access key events if one of the following is true:
The current process is running as the root user.
Access for assistive devices is enabled. In Mac OS X v10.4, you can
enable this feature using System Preferences, Universal Access
panel, Keyboard view.
that is a very serious limitation since I also want my application to work without any weird settings. Is there any way to work around this? If not, is there any alternative to using Taps in Carbon?
Thanks!
The easiest way is to use the semi-deprecated Carbon function RegisterEventHotKey, see this SO Q&A, for example.
If not, you need to live with that restriction. The restriction is there to prevent a bad person to install keylogger behind the scenes. You need to ask the user to open the preferences, type the admin password etc.
You could try to use AXMakeProcessTrusted. This is supposed to be the same as Access for assistive devices on a per process basis.

Resources