Windows Phone 7 Development talk on the 31st day-12th: Shake mobile phones

Source: Internet
Author: User

This article is about Windows Phone 7 development on the 31st day"12th day of the series.

Yesterday, we talked about the acceleration sensor for Windows Phone and how to simulate a real device to provide us with data. Today, let's talk about the VibrateController and the feedback on what is happening in your application.

Telling someone how to shake his cell phone will immediately trigger some fun jokes, so before I mention 15 "Shakes", they will be taken out of your system. Let's get started ...... I can wait.

Why shake the phone?

There are many silly and/or inappropriate reasons to shake a cell phone. However, the purpose of this article is to explain the specific causes of mobile phone vibration.

Game feedback

Let's start with an obvious example: game. When you play a game, you may not always be able to provide users with all the information they need. (Especially when their fingers are on the screen .) Give them some tactile feedback to let them know that they are being attacked or that they have something to pay attention.

Button feedback

This may be very common for you, but for every button in your program, tactile feedback can let users know that they have pressed the corresponding button. In Windows Phone, the default button becomes a solid color when it is pressed, but many times users are not sure if they have clicked it (especially when this operation takes several seconds ). Provide them with a fast vibration to let them know that they have achieved their goals.

Push notification

The other is obvious, but the time when the vibration feedback is not fully utilized is push notification. By default, if you receive an email, short message, or so on, your phone will shake (or ring ). We can use the same user experience in the program. When a user is warned of something, the phone can vibrate. This is especially important when your program is passive. For example, a program is tracking your location and you are passing through the neighbor's house. If the signal disappears or reaches the target distance, only one vibration is needed to let users know without looking at their mobile phones. In the same example, you can even report to them every 1/4 miles, so that they will realize how far they are going.

How to shake a cell phone?

Thanks a lot. This is incredibly simple. You only need two lines of code to implement it, but you will spend a lot of time adjusting it to meet your specific needs. This is the most basic code:

VibrateController vc = VibrateController. Default;
Vc. Start (TimeSpan. FromMilliseconds (100 ));

How long does it take to vibrate?

There is no uniform standard for how long the prompt should shake, but I will follow some rules and share with you:

  1. It is suitable for clicking a button for 1/10 seconds (this is also the shortest time for VibrateController to vibrate ).
  2. 2 seconds = your user will say"What's wrong with my phone number?". 2 seconds is too long for any prompt.
  3. 300 milliseconds (about 1/3 seconds) seems to be the right time for a stable vibration prompt. In this way, your users will not think that the phone is faulty.
  4. Fast pulse vibration is another good way to let users know what is happening. I have included this example in the code, but if you want to know more clearly how I do it, let's take a look at my tutorial on "How to Create a SetTimeout Function in SilverLight.

Download Sample Code

In the next few days, we will have some important topics, including location services and tombstone mechanisms. Please leave a comment in any article in this series to tell me what you think!

Address: http://www.jeffblankenburg.com/post/31-Days-of-Windows-Phone-7c-Day-12-Making-A-Phone-Vibrate.aspx

If you like my article, click "recommendation". Thank you!

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.