How to detect headset wire control in macos - objective-c

In windows/linux, The headset wire control is the same as the keyboard event. However, I can't use CGEventSourceKeyState to detect headset wire control in macos.

Create an instance of the MPRemoteCommandCenter class from the MediaPlayer framework, then register for any commands your app supports. However, in order to cooperate with other apps well, you should register as a "Now Playing" app via MPNowPlayingInfoCenter.
See "Becoming a Now Playable App" for an example of how to implement this.

Related

Raspian howto disable doubleclick drag etc

I'm using a raspberry pi with a touchscreen monitor and chrome (kiosk mode) for displaying a web application. I want to disable the doubleclick, drag support, multitouch etc.
The only thing the user should do via the touchscreen is a simple (single) click.
BTW: To disable the dbclick by the web application is no solution for me. I want to change these mouse settings in raspian.
So my question is: How to change the mouse settings for doubleclick etc. systemwide?

Calabash-ios - Put the device is Airplane Mode

Is there any way to interact with an iPhone's settings when testing a device using calabash-ios?
Using calabash for Android (calabash-android) I can make system calls in my step-definitions using adb, Android Device Bridge. For example: system(adb shell am broadcast -a android.intent.action.AIRPLANE_MODE)
This will make a call right into the Android OS.
I don't want to have to manually set up a device and then run tests. I would like to automate it. Is this possible?
Examples: I want to see if all my tests pass with airplane mode on. Then I would like to programmatically set airplane mode to off and see if all my tests pass. I would prefer not to have to change a setting like this manually and then run all tests.
Thanks
It is not possible to put your device into Airplane mode with Calabash iOS.
You could write a backdoor method in your app that simulates Airplane mode.
Be aware however, that Calabash iOS embeds an http server in your application; that is how the client gem communicates with your app.
http://calabashapi.xamarin.com/ios/Calabash/Cucumber/Core.html#backdoor-instance_method
The Xamarin Test Cloud has some options for testing apps in Airplane mode.

Get Window handle in Windows store app

I am working on a app which needs to have a custom camera capture dialog to enable zoom, flash etc. which default CameraCaptureUI does not have. My app will be deployed on tablets and I have a .NET SDK (provided by tablet vendor) which I can use to enable zoom, flash and every other thing. The SDK is not compatible with windows store app and it uses Win32 api but I can still use some of it functions.
So this SDK have a preview method which requires window handle (InPtr) to start a preview. The problem is I cant find window handle for a store app window or rather I don't know how to find it. If i can find it somehow I am sure I will be able to implement other features easily enough.
Can someone show me how to find window handle in Windows store app?
Thanks a lot for any pointers!
According to this post: http://tinyurl.com/pf5kpyv you can find the window handle of a store app using the Win32 API. But if your target is WinRT, you won't have the Win32 API available (probably you already know this). If your target is full Windows 8.1, it might be easier to just write it as a non-store app. Of course, if your client requires it to be "modern" than you're stuck :)

Titanium iOS auto restart application in background once swiped off from background

I am working in an application that detects any Beacons nearby and gives and alert in the form of local notifications for iOS. I used TiBeacons library for titanium which did the work but I am right now stuck with an issue where I need to keep the Application running even when the user swipes off the application from background.
I was able to make it work in background which is the paused state,but is it possible to make it restart itself in the background when the user swipes the app from the background processes running,maybe with a delay if not promptly?? Thanks
There is no way to restart application after user removed it from a memory. This would be huge security bridge allowing developers to do lots of evil things to customers' devices.
You can run your code only when app is in foreground and background but never when it's killed.
You can try activate your app by receiving notification from Apple Notification Center Service:
The purpose of the Apple Notification Center Service (ANCS) is to give Bluetooth accessories (that connect to iOS devices through a Bluetooth low-energy link) a simple and convenient way to access many kinds of notifications that are generated on iOS devices.
The ability to detect iBeacons after the app was killed in the task switcher was only added in iOS 7.1. Also, I believe this functionality requires that beacon monitoring be set up with the app's main AppDelegate object as the CoreLocation delegate. I do not know much about Titanium, but glancing at the source, it appears it does not do this, and instead uses a different class as the CoreLocation delegate. This may explain why this does not work for you.
If my suspicion is true, you would not be able to detect after the app is killed using an unmodified version of that library.
Since I am not a Titanium expert, it would be best if someone who knows more about it could confirm or refute my suspicion.

Appcelerator Titanium - how I can open a window at a fixed moment of time

I'm a newbie in using appcelerator titanium, and I'm using this platform to create an alarm application. But I'm facing with a problem. I don't know how I can open an application's window at a fixed moment of time (even when my application is closed, and the device is sleeping). Have any features as Alarm and BroadcastReceiver as in Android OS? Please help me, thanks!
On which alarms do yo want to respond?
On iOS you can't wait for such events when your app is in background in general and you can't listen for them with titanium. With Titanium you can use LocalNotification (working like a timer). In their callback you should set a property and when the user opens your app you should check this property and open your window.
On Android you may create a background service but i have no idea how to listen on native events (except battery) on android.
Thanks for your reply.
I'm finding for a mechanism that has ability to wake up the device when it is sleeping and then open a window in my application. In Android, I know a mechanism called Alarm, I can register an Alarm with the Android OS, and after a specified moment of time (specified when I register Alarm), Android OS would be wake up the device (if it is sleeping) and send an Intend. And then, in my application I can register a BroadcastReceiver that listen for that Intent sent by Android OS. In that BroadcastReceiver, I can do something like start services, open new window (known as Activity in Android).