Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Does Notification.DEFAULT_VIBRATE require vibrate permission?

Sometimes I read that

notification.defaults|= Notification.DEFAULT_VIBRATE;

and

notification.defaults = Notification.DEFAULT_ALL;

requires the vibrate permission

<uses-permission android:name="android.permission.VIBRATE" ></uses-permission>

But sometimes I read that it doesn't.

Which one is the correct information?

like image 591
Xander Avatar asked Oct 31 '12 13:10

Xander


2 Answers

Ok, apparently, you do need the vibrate permission. Thanks!

like image 64
Xander Avatar answered Nov 04 '22 19:11

Xander


You may be interested in reading: https://android.googlesource.com/platform/frameworks/base/+/cc2e849

As of 4.2.1:

Notification vibration improvements: [DO NOT MERGE]

  • When notifications vibrate as a fallback (that is, because they want to play a sound but the device is in vibrate mode), this no longer requires the VIBRATE permission.
  • As a bonus, if your notifications use DEFAULT_VIBRATE, you don't need the VIBRATE permission either.
  • If you specify a custom vibration pattern, you'll still need the VIBRATE permission for that.
  • Notifications vibrating in fallback mode use same vibration pattern but can be changed easily in future.
  • The DEFAULT_VIBRATE and fallback vibrate patterns are now specified in config.xml.
like image 23
Mike Lambert Avatar answered Nov 04 '22 19:11

Mike Lambert