Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do notification in android?

I am doing a helpdesk application on android. I want to implement a notification for unread tickets(customer suggestions or complaints). In iPhone version of this app, even if the app is not open a counter for unread tickets on the app icon itself, is it possible in android. If it so please help me to implement like iPhone otherwise help me to implement normal android notification for unread tickets.

Thanks

like image 408
Aju Avatar asked Aug 11 '11 06:08

Aju


2 Answers

call this method

private void triggerNotification(String s) {
    CharSequence title = "Hello";
    CharSequence message = s;
    NotificationManager notificationManager;
    notificationManager = (NotificationManager) context
            .getSystemService("notification");
    Notification notification;
    notification = new Notification(
            com.yourPackage.R.drawable.notification, "Notifiy.. ",
            System.currentTimeMillis());
    PendingIntent pendingIntent = PendingIntent.getActivity(context, 0,
        null, 0);
    notification.setLatestEventInfo(context, title, message, pendingIntent);
    notificationManager.notify(1010, notification);
}
like image 112
Rasel Avatar answered Sep 30 '22 03:09

Rasel


this may help: http://developer.android.com/guide/topics/ui/notifiers/notifications.html

like image 41
Talha Ashfaque Avatar answered Sep 30 '22 04:09

Talha Ashfaque