Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vibrate permission required only on some devices

I'm testing my app that uses the NotificationManager to send up a notification which does a vibration. Currently, I do not have the Vibrate permission in my manifest. I understand the need to have it, but am seeing some weird behavior between devices without having the permission.

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

I mainly test on a Galaxy S4 which allows me to do the vibration, even without having the permission set. It's on Android 4.3. I just tested with a Samsung Galaxy Nexus which generated a Runtime exception when trying to do the vibrate, indicating I didn't have permission. The Nexus is on Android 4.3.

I understand that I should have the permission, but why is it that the S4 didn't seem to care that it lacked the permission? Is it possible that the S4 stock ROM really doesn't care about permissions?

Here was the inner exception generated, for what it's worth:

 Caused by: java.lang.SecurityException: Requires VIBRATE permission
        at android.os.Parcel.readException(Parcel.java:1431)
        at android.os.Parcel.readException(Parcel.java:1385)
        at android.app.INotificationManager$Stub$Proxy.enqueueNotificationWithTag(INotificationManager.java:320)
        at android.app.NotificationManager.notify(NotificationManager.java:136)
        at android.app.NotificationManager.notify(NotificationManager.java:109)
like image 217
Stealth Rabbi Avatar asked Aug 29 '14 12:08

Stealth Rabbi


People also ask

What is android permission Get_accounts?

android.permission.GET_ACCOUNTS. Allows access to the list of accounts in the Accounts Service. The app uses this permission in an effort to find the device user's name when the support session is presented to a representative.

What is READ_PHONE_STATE permission?

READ_PHONE_STATE is one of the Android permissions categorized as dangerous. This is because it “allows read only access to phone state, including the phone number of the device, current cellular network information, the status of any ongoing calls, and a list of any Phone Accounts registered on the device” [2] .


1 Answers

You should include this permission.

I tested without problems for Google Nexus 4, but I had to put the permission because other models like HUAWEY and BQ needs it.

like image 169
malcubierre Avatar answered Nov 08 '22 20:11

malcubierre