Physical-button-hold shortcut on mobile - mobile

Is it possible to utilize button-hold on mobile phone as a trigger for some programmed action? E.g. my app runs in background and it is programmed to open up if I hold both volume up and volume down buttons for 3 seconds.
I want to make iPhone/Android app. I haven't choose any framework yet, it's a question of technical possibility of such an idea, but I'll probably use objective-C/Swift as I have an iPhone.

I found an information for iOS on how to use events from volume buttons here, however it seems to be impossible to use events from power button or home button in the background, except from noticing that the app went from foreground to the background at home/power-button action.

Related

change an icon of an installed application using xamarin

I want to change the icon and the name of an existing application installed on the device. would be ideal if the application icon could somehow be hidden.
the project I am working on is using a secondary application that I do not want the user to see. only my application should be able to launch it.
but I figured I would have a better chance just changing the icon to something similar to my application.
is any of this possible?
If you do an update to the application it's straightforward to change in your application file. Do you mean you want to change the icon remotely without a redeploy? (It seems like an update could be easier).
In terms of the secondary application, can you give more details on what you're using it for? If you're doing Android development, for example, if you're just using this to do a background task and the user never interacts with it it seems like moving this to a service could be ideal.

Touch screen operations for .NET windows application?

We are building a Windows application in .NET and one of its requirements is touch screen monitor. Other than that, it's a normal windows form based application. But except for making UI items little bigger for touch, I can't find anything I as a developer need to do for the requirement since touch screen is basically mouse operations. Am I missing something?
No, you are not missing anything. Do get the actual hardware hooked up so you can test it, "little bigger" is invariably underestimating the problem of fat fingers. Everything should work from a single click, right-clicks are horribly impractical, double-clicks are best avoided.
The only other thing you'll want to do is go into the Control Panel + Display applet and change the size of standard Windows UI elements. Pick a large window caption font if you want to allow the user to drag or close windows. Make the scrollbars at least twice as wide. And the menu and message box font. Go in the Mouse applet to increase double-click range and time if you want to support that.
If you do not need touch-specific event handling I think it's all you have to do. But touch means more than that and you may want to support it in a better way: http://archive.msdn.microsoft.com/WindowsTouch/Release/ProjectReleases.aspx?ReleaseId=2127

Need clarification on using audio on button click, background audio, etc in Windows Phone

This is a WP 7.1/7.5/Mango Silverlight app.
I have a requirement where I need to play sounds on image click (3-4 images) and also an audio plays when user navigates to the page first time.
So I implemented that using MediaElement as mentioned here: Windows Phone 7.1 - Media Element not playing
Issue: Now I was testing the app. I started playing radio on the phone. Then started my app. Radio was still playing. Now when I navigated to the page that has audion on page Load, radio stopped.
Certification Requirements (6.5 - Non Music..) is very confusing: http://msdn.microsoft.com/en-us/library/hh184838(v=vs.92).aspx
Questions:
1: Do I need to ask user permission in this case (using a pop-up) before playing my audio?
2: Req 6.5.3 says no need to ask permission for non-interactive audio. What is that?
3: If I have to ask the user and if user selects No i.e. not to stop thier radio(or other music), then the only was for me to still allow to play my audio is using SoundEffect insted of MediaElement. So am I doing wrong with MediaElement?
4: I am also planning to add a background/ambience music to my app in future once I am done setting up above audios. Req 6.5.4. says - The SoundEffect class must not be used to play a continuous background music track in an application. No so in that case I am left with MedieElement only.
Here's rhe Sound Sample(second one) I found: http://msdn.microsoft.com/en-us/library/ff431744(v=vs.92).aspx#BKMK_Media Is this the only way I can do?
Any suggestions really appreciate.
Note: The button click and page load audio files are short clips(max 5 secs) e.g. How are you?, What's your name? It's so much fun here, etc. So they are not songs.
To answer one (or more) of you questions:
You do not need to ask the user permission before playing audio
All this means is if something is playing before your sound plays you must resume it
No you should be using a sound effect if its a sound effect and a media element if its a media file. Sound effect are usually 5-10seconds and not continuous. BAckground music that loops is not a sound effect.
In Silverlight for WP7 only one MediaPlay can be played at a time. I got around this by making my project a Windows Phone Silverlight an XNA application Refer to my previous post. The idea is that my XNA part plays the sound effects while my mediaelement plays the background audio.
It can be a little confusing sometimes. Here is how I understand it:
You don't ask permission when all these conditions are met:
The sound doesn't repeat
The sound is interactive (in response to something the user did, like click a button)
You don't stop the background music (which means not using a MediaElement)
You do ask permission when:
The sound repeats or is continuous
The sound is like background music
You use a MediaElement (Because it stops the background music)
A clarification on interactive sounds: in my opinion a sound to signify that the program's state has changed (such as a timer's alarm going off) is still somewhat interactive and wouldn't need permission. Unless of course you start playing a song that functions more as background music.

How do you detect tablet PC screen rotation in a full screen Silverlight application?

I am working on a Silverlight 4 out of browser (OOB) application on a Windows 7 tablet PC. The majority of the time, the program is in full screen mode. However, if the user rotates the tablet, the application rotates and stays full screen, but is scaled for the previous screen orientation. Taking the application out of full screen and putting it back into full screen rescales everything correctly. Is there any way I can detect when the screen rotates? So far I've tried the app's Resize, LayoutChanged and FullScreenChanged events and have a handler for the main page's SizeChanged event. None of these get fired when the application is rotated in full screen mode.
Per Josh Einstein's suggestion, I tried polling the ActualWidth/Height of the application on a timer. It looks like after the rotation, the ActualWidth/Height values returned from the Silverlight plug-in are the pre-rotated values. Only taking it out of full screen and putting it back in full screen will change the resolution of the plug-in. The HtmlPage.Eval hack didn't work since I am OOB.
The WP7 version of Silverlight has the OnOrientationChanged event, which doesn't seem to be available in the desktop version. Anyone have any ideas?
Great question but as far as I can tell, it doesn't seem to be possible. I tried changing the screen resolution in a virtual machine (orientation change is really just a screen resolution change that results in width being larger than height or vice versa) and could not trigger any layout events.
The issue seems to be that the Silverlight plugin itself is not resized. With an elevated out-of-browser application you could presumably use COM interop with WMI to get the actual screen resolution, but it's kind of hacky. If it's an in-browser application, you could use the HTML DOM. In both cases, you'll probably have to poll for the current screen resolution instead of being notified via an event.
Mister Goodcat has written a blog post about how to get at this information in both scenarios.
I would file it as a Silverlight bug too.

Wpf popups or modal windows as user entry screens?

I am building an application which has multiple user entry screens. I would like to know if there are advantages/disadvantages of using wpf popups rather than modal windows?
I am using mvvm-light.
I have noticed that popups are being used extensively in touch applications (eg iPad).
The issue is really one of Desktop vs. Web applications. Popups in Silverlight (or other touch apps) involve having only one real window to work with (the mobile surface, or the web browser). If you are writing a desktop app, then modal windows will probably match user expectations better as Popups cannot leave the parent window.
pop ups are nice but are very difficult to control. In our apps we are using adorners to be 'pop-up' editors - we have created a control that can hold any other control and display it in the adorner layer of the main window. This allows to do things such as having 1 control appear next to another yet still have the other control in use or we can grey out the background and force focus to the new control and not allow any other control to be used until the 'ok' button is pressed. If you Google for adorners in wpf you will find a lot of excellent articles.

Resources