Vibration resolution required on select devices only

I am testing my application that uses the NotificationManager to send a notification that causes vibration. Currently, I do not have Vibration permission in my manifest. I understand that you need to have it, but I see some strange behavior between devices without permission.

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

I mainly test the Galaxy S4, which allows me to vibrate without even having the resolution set. This is on Android 4.3. I just tested with a Samsung Galaxy Nexus that threw a Runtime exception when trying to make a vibration, indicating that I don't have permission. Nexus is on Android 4.3.

I understand that I must have permission, but why does S4 not seem to care that it does not have permission? Is it possible that the S4 ROM really doesn't care about permissions?

An internal exception was created here, for which it stands:

  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) 
+6
source share
1 answer

You must enable this permission.

I tested without problems for Google Nexus 4, but I had to set this resolution because it needs other models like HUAWEY and BQ.

+6
source

Source: https://habr.com/ru/post/974544/


All Articles