Vla*_*mir 6 android android-notification-bar
所以我在我的活动中创建了这个通知
Notification n = new Notification.Builder(getApplicationContext())
.setContentTitle("New mail from " + sender)
.setContentText(subject)
.setSmallIcon(R.drawable.notification)
.build();
Run Code Online (Sandbox Code Playgroud)
我现在如何在状态/通知栏中显示声音?
android开发人员站点上有一些不错的文档,请 查看NotificationManager文档的
在这里,一些代码...:
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// mId allows you to update the notification later on.
mNotificationManager.notify(mId, n);
Run Code Online (Sandbox Code Playgroud)
请注意,将您的意图添加到通知中也是一个好主意...
mBuilder.setContentIntent(resultPendingIntent);
Run Code Online (Sandbox Code Playgroud)
要添加声音,您可以使用Notification.Builder.setSound()方法。
| 归档时间: |
|
| 查看次数: |
10978 次 |
| 最近记录: |