English 中文(简体)
英语:振动手法(如果电话没有耳机?)
原标题:Android: vibrator method (if phone has no vibrator?)

我想在我的肩上使用动人手法,我用我的电话工作,这部电话有巨大的震.。 然而,没有镜头的电话却发生。 它根本不可行? 这是否阻止了人们的工作? 或根本不在市场上展示? 或者我是否必须问电话,如果它有一台动手?

我也想知道,这部法典是否好,是否需要调整? 这里是我的法典。

Vibrator vi;

vi = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);

vi.vibrate(100);

<uses-permission android:name="android.permission.VIBRATE" /> (In manifest)

感谢一切帮助。

最佳回答

Check the docs, http://developer.android.com/reference/android/os/Vibrator.html

如果在像这样的电话上有一名摄影师在场的话,你需要做的是检查:

 Vibrator vi;

 vi = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);

 if(vi.hasVibrator()){
     vi.vibrate(100);
 }

由于振奋剂市场可过滤<>/em>。 避免这种情况,你可以使用“false”的特性。

 <uses-permission android:name="android.permission.VIBRATE" />
 <uses-feature android:name="there.isnt.a.vibrate.feature" android:required="false" />

本文记载的所有文件:

http://developer.android.com/guide/topics/manifest/uses-permission-element.html

http://developer.android.com/guide/topics/mani.4/1999//uses-feature-element.html

<><><><>><>>>>>><>>>>>>>

由于你正在使用振奋剂许可,因此不存在维比特特征。 因此,你的ok子只使用使用,并在 Java法中进行检查。

装置需要一台振动器,才能与甲状腺市场兼容,但当然,这对亚马逊和其他附属市场来说,这只字塔。 (Barnes & Noble Nook don t have a vib).

This is backed up by Dianne Hackthorn (Android lead dev at Google s) reply to this thread: http://groups.google.com/group/android-developers/browse_thread/thread/7713e796ea2d0f5f

问题回答

它根本不可行? 这是否阻止了人们的工作?

你的振奋人心的要求应当完全被忽视。

或根本不在市场上展示?

我们不能从市场上过滤缺乏振动发动机的装置。 因此,。 如果你要求,它就意味着一个硬件特征。

或者我是否必须问电话,如果它有一台动手?

您可在第11级及11级以上——见Blundell的答复。





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...