How to do notification in android?

前端 未结 2 2064
攒了一身酷
攒了一身酷 2021-01-05 21:48

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

相关标签:
2条回答
  • 2021-01-05 22:38

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

    0 讨论(0)
  • 2021-01-05 22:46

    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);
    }
    
    0 讨论(0)
提交回复
热议问题