1
J'ai fait une méthode qui envoie une notification locale lorsqu'un progrès se termine le chargement, lorsque je construis l'App, il est tout clair sans erreurs/avertissements que je recevais ce après avoir relâché avec Google plantage console rapportnotification locale fait SecurityException
Voici la méthode de notification:
public void notif() {
final int NOTIFICATION_ID = 1;
int icon = getIcon();
String provx = getProv();
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(getBaseContext());
Notification notification = mBuilder
.setSmallIcon(icon)
.setVibrate(new long[]{1000, 1000})
.setLights(Color.BLUE, 700, 500)
.setContentTitle("New notification!")
.setStyle(new NotificationCompat.BigTextStyle().bigText(provx))
.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
.setContentText(provx)
.build();
NotificationManager nMN = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
nMN.notify(NOTIFICATION_ID, notification); //here where I got the error
}
C'est le journal de l'accident:
java.lang.SecurityException:
at android.os.Parcel.readException (Parcel.java:1425)
at android.os.Parcel.readException (Parcel.java:1379)
at android.app.INotificationManager$Stub$Proxy.enqueueNotificationWithTag (INotificationManager.java:246)
at android.app.NotificationManager.notify (NotificationManager.java:135)
at android.app.NotificationManager.notify (NotificationManager.java:111)
at com.dev.days.myapp.Splash.notif (Splash.java:184)
at com.dev.days.myapp.Splash$1.run (Splash.java:151)
at java.lang.Thread.run (Thread.java:856)
-vous maintenez la touche [ 'VIBRATE'] (https://developer.android.com/reference /android/Manifest.permission.html#VIBRATE) permission? –
Non, existe-t-il une permission d'utiliser les vibrations? Si oui, veuillez le fournir –