How to make a phone call using intent in Android wear? - wear-os

Code like
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:0987654321"))
startActivity(intent);
works perfectly well on smartphone (the phone call occurs immediately), but not on smartwatch - there we can see a menu
that waits for user's manual selection. Is it possible to perform this selection from the application or somehow close this window?

Related

Windows: send Mouse/Keyboard event to background window?

My application is a fullscreen window which is rendering a designated other window (from dwm), for example Google Chrome. I would like to know if it's possible to send events (such as mouse keyboard events) to the specified window.
Of course the designated window has to stay in background, and my current application on the foreground.
My application is written in C++. I'm working on Windows 7/8.
Just to put it into an answer.
Based on this question Does any program/language/library that interacts with windows do it via the WIN32 API? you should be able to use the windows API to send a windows message to any window. All you need to get is that windows handle, or you could do a broadcast to all windows.
The specific function http://msdn.microsoft.com/en-us/library/windows/desktop/ms644950(v=vs.85).aspx
Though that function will block until the windows responds and processes the message, this could hurt GUI performance. If you notice issues try implementing http://msdn.microsoft.com/en-us/library/windows/desktop/ms644951(v=vs.85).aspx instead.

How to make a fixed Toast notification

I'm new to Windows Phone development and I've found something about background agents in WP 7.5:
http://code.msdn.microsoft.com/wpapps/CSWP7ScheduledTaskAgent-6450bcf1
I wasn't able to find a way of making the toast notification fixed, I mean, when it appears on the screen it should disappear.
Is there any way of doing this? any advices, documentation should be great.
Thanks.
Toast Notification by the OS
When a toast notification is created, the OS handles the amount of time it is displayed for...
A toast notification displays for about 10 seconds unless the user
dismisses it with a flick to the right. If the user taps the toast, by
default, your app's start screen launches. Or, you can choose to
specify which screen of your app will launch.
Taken from the official documentation.
The API for toast notifications does not allow you to specify a time. Only a title, content and deep link into your app. This is the only type of toast/notification that can be used by a Background Agent. But it will appear:
on the Start screen
when your app is being used
when any other app is being used.
Custom toast-like notification (eg. Coding4Fun Toolkit's Toast Prompt)
A custom toast notification, although more flexible, must obey all the system rules unlike the system's Toast Notification which has special permissions.
This means the Coding4Fun Toolkit's Toast Prompt cannot:
Display notifications when your app is not running (apps cannot run in the background, they are essentially paused)
Display notifications when the user is on the Start screen or not using your app
Having a permanently (or long) displaying toast notification would be annoying to the user (hence the 10 second limit by the OS version) so do think carefully about why you need it - is the System Tray or MessageBox a better idea?
If you're new to Windows Phone, I would recommend using a handset for a while to get the feel for how the system works and how other apps use all kinds of notifications.

Stop default launch of IE from an NFC "tap and send"

We have a very simple demo app with the Windows Phone map app sending a link via 'tap and send' to an NFC tablet. I can get and read the URL coming over, but Windows 8 pops over a purple bar in the top right asking if I want to receive content from another device, which then opens IE to the URL.
Is there an easy way to stop the default Windows behavior (not have the purple bar slide in)?
Thanks!
There is no way of disabling the toast pop-up and still have the OS launch the browser by default.
When not inside of a "metro style" app toast will always should for incoming proximity payloads such as an NFC tap, however if you are inside of your application you can subscribe to the proximity events and respond with your own user experiences, which means you don't have to show the toast. However when you are in the OS/Start Menu experience Windows always mandates the toast I'm afraid.
In addition; following on from the title of your question NFC tags respond based on the default program for the MIME type/extension on the tag (if using a URL). So if you want a custom experience instead of IE launching you can register your app again an extension or protocol such as map://mydataUrl and Windows will automatically launch your app when you acknowledge the toast popup.

Possible to tell if NSApplicationActivationPolicyProhibited application is active?

Using JUCE with TUIO, I'm developing a multi-touch utility to send "hot keys" commands to other applications (I am using a usb touch frame that sends TUIO messages). For instance, I provide an interface through which users can touch-and-hold to program a key combo and then tap that button to send the programmed key combo to another app. They way I accomplish this on OSX is by running my utility as a "background only" application (NSApplicationActivationPolicyProhibited). I use [NSWindow setCanHide: NO] so the GUI of my utility is visible even though it runs as a background app.
It works well except in the case that a window from another application is on top of mine. What happens is that touches get passed through that other app into mine- causing unintentional button pushes in my app. Normally, I could have my app only listen to the TUIO touch callback whenever is is the active application, [NSApp isActive]. But, since my app is background only, it is never active and I have no way to tell if another window is covering it to prevent touches.
So, is there any way for a "background only" app to be able to tell if it is on top of all other windows? Or, is there a way from within my app to get a list of all Cocoa windows from other applications and be able to tell if they are appearing on top of my "background only" app?
Also, does anyone know how I would go about all of the above in Windows? In other words, what is the Windows equivalent of NSApplicationActivationPolicyProhibited and would I be able to tell if it is covered by other applications' windows?

Prevent Start Menu, Camera button from tombstoning WP7 Application

I have a WP7 application that I've disabled the idle capabilities of the phone with such as:
PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;
PhoneApplicationService.Current.ApplicationIdleDetectionMode =
IdleDetectionMode.Disabled;
However, the camera button and start menu still pause the application and resume it afterwards. I want the app to run regardless of these buttons being pushed. How can I prevent these buttons from tombstoning the app?
Tombstoning always occurs if the user presses the windows key or camera button. The code you've shown ensures that your app will continue to run under a lock screen, not if it will run when your app is tombstoned. In the current version (7.0), there is no multitasking for third parties, whereas Mango (7.1) allows for some more freedom with respect to multitasking.
Presumably this app is targetted at 7.0, so your app will be tombstoned and you will have to handle it. There is no way of having your app continue running in the background.
On a side note, you'll still have to handle tombstoning in Mango as well, but you do get more abilities to run your app in the background.

Resources