So i have created this notification in my activity
Notification n = new Notification.Builder(getApplicationContext())
.setContentTitle("New mail from " + sender)
.setContentText(subject)
.setSmallIcon(R.drawable.notification)
.build();
How can i now show it in status/notification bar along with the sound?
There is some good documentation at android developer site and have a look at the NotificationManager doc's
Here you go, some code...:
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// mId allows you to update the notification later on.
mNotificationManager.notify(mId, n);
Note that it is also a goo idea to add your intend to the notification...
mBuilder.setContentIntent(resultPendingIntent);
To add sound you can use the Notification.Builder.setSound()
method.