如何申请的震动权限在我的Android应用程序?
How can I request the vibrate permission in my Android application?
下面是链接到reference
添加到您的清单,作为清单
元素的直接子:
Add this to your manifest, as a direct child of the manifest
element:
<uses-permission android:name="android.permission.VIBRATE" />
这是你如何让手机震动直通code:
This is how you let the phone Vibrate thru code:
// Get instance of Vibrator from current Context
Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
// Vibrate for 300 milliseconds
v.vibrate(300);
对于一个更有创意的方式尝试星球大战主题= D
For a more creative pattern try the star wars theme =D
v.vibrate(new long[]{0, 500, 110, 500, 110, 450, 110, 200, 110, 170, 40, 450, 110, 200, 110, 170, 40, 500}, -1);
上一篇:如何检测(路由器/网关)的净变化公网IP地址?公网、网关、路由器、地址
下一篇:android.content.res.Resources $ NotFoundException:无法找到资源编号为0xffffffff编号、资源、res、content