Meh*_*mir 4 notifications android
我想创建一个没有声音的通知。我怎样才能做到这一点?我尝试了以下代码,但不适用于我:
notification = mBuilder
.setStyle(notiStyle)
.setSmallIcon(notificationIcon)
.setTicker(title)
.setWhen(0)
.setAutoCancel(true)
.setContentTitle(title)
.setContentIntent(resultPendingIntent)
.setSound(null).build();
Run Code Online (Sandbox Code Playgroud)
您可以NotificationCompat.Builder 不使用而创建对象setSound()。这将创建没有声音的通知。
notification = mBuilder
.setStyle(notiStyle)
.setSmallIcon(notificationIcon)
.setTicker(title)
.setWhen(0)
.setAutoCancel(true)
.setContentTitle(title)
.setContentIntent(resultPendingIntent)
.build();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7570 次 |
| 最近记录: |